Example: 05-Feature-Detection/edges.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Edge detection with Canny:
#
# This example demonstrates the Canny edge detector.
import sensor
import image
import time

sensor.reset()  # 初始化相机传感器。
sensor.set_pixformat(sensor.GRAYSCALE)  # 或 sensor.RGB565
sensor.set_framesize(sensor.QQVGA)  # 或 sensor.QVGA(或其他)
sensor.skip_frames(time=2000)  # 让新设置生效。
sensor.set_gainceiling(8)

clock = time.clock()  # 跟踪FPS。
while True:
    clock.tick()  # Track elapsed milliseconds between snapshots().
    img = sensor.snapshot()  # 拍照并返回图像。
    # Use Canny edge detector
    img.find_edges(image.EDGE_CANNY, threshold=(50, 80))
    # Faster simpler edge detection
    # img.find_edges(image.EDGE_SIMPLE, threshold=(100, 255))
    print(clock.fps())  # 注意:您的 OpenMV Cam 在连接到

results matching ""

    No results matching ""