Example: 05-Feature-Detection/selective_search.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 选择性搜索示例

import sensor
import time

sensor.reset()  # 重置并初始化传感器。
sensor.set_pixformat(sensor.RGB565)  # 将像素格式设置为RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA)  # 将帧大小设置为QVGA (320x240)
sensor.skip_frames(time=2000)  # 等待设置生效。
sensor.set_auto_gain(False)
sensor.set_auto_exposure(False, exposure_us=10000)
clock = time.clock()  # 创建一个时钟对象来跟踪FPS。


while True:
    clock.tick()  # 更新FPS时钟。
    img = sensor.snapshot()  # 拍照并返回图像。
    rois = img.selective_search(threshold=200, size=20, a1=0.5, a2=1.0, a3=1.0)
    for r in rois:
        img.draw_rectangle(r, color=(255, 0, 0))
        # from random import randint
        # img.draw_rectangle(r, color=(randint(100, 255), randint(100, 255), randint(100, 255)))
    print(clock.fps())

results matching ""

    No results matching ""