Routine explanation -09-edges Quick edge detection

This routine is 09-feature-Detection-edges.py\ The goal of this routine is to use the canny operator to achieve fast edge detection, the edge detection using the canny operator is the simplest and fastest edge detection, but the detection effect is not as good as the edge detection effect of morph transform.

# Canny边缘检测:
#
# 这个例子展示了Canny边缘检测。
import sensor, image, time

sensor.reset() # 初始化sensor.

sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565
#设置图像色彩格式,有RGB565色彩图和GRAYSCALE灰度图两种

sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
#设置图像像素大小

sensor.skip_frames(30) # 让新的设置生效
sensor.set_gainceiling(8)

clock = time.clock() # 跟踪FPS帧率
while(True):
    clock.tick() # 追踪两个snapshots()之间经过的毫秒数.
    img = sensor.snapshot() # 拍一张照片并返回图像。
    # 使用Canny边缘检测器
    img.find_edges(image.EDGE_CANNY, threshold=(50, 80))
    #threshold设置阈值

    # 更快更简单的边缘检测
    #img.find_edges(image.EDGE_SIMPLE, threshold=(100, 255))
    print(clock.fps()) # 注意:你的OpenMV摄像头的运行速度只有它的一半

original image:

! [] (/assets/13-09-01-001.jpg)\ Edge detection using the canny operator:

! [] (/assets/13-09-01-002.jpg)\ Use 04-image-Filters-edge_detection.py morph to transform edge detection:

Singtown Technology OpenMV official Chinese document function explanation:

results matching ""

    No results matching ""