Example: 01-Camera/03-Event-Cameras/01-Frogeye2020/frogeye2020_with_tracking.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 此示例展示了如何使用frogeye2020事件相机进行跟踪。
#
# frogeye2020是一款320x240的事件相机。每个像素有两个位,显示无运动,
# 一个方向的运动,或另一个方向的运动。传感器以50 FPS运行。

import sensor
import image
import time

sensor.reset()  # 重置并初始化传感器。
sensor.set_pixformat(sensor.GRAYSCALE)  # 将像素格式设置为灰度
sensor.set_framesize(sensor.QVGA)  # 将帧大小设置为QVGA (320x240)

palette = image.Image(1, 256, sensor.RGB565)

for i in range(64):
    palette.set_pixel(0, i, (0, 0, 0))

for i in range(64, 128):
    palette.set_pixel(0, i, (255, 0, 0))

for i in range(128, 192):
    palette.set_pixel(0, i, (0, 0, 255))

for i in range(192, 256):
    palette.set_pixel(0, i, (0, 255, 0))

clock = time.clock()

while True:
    clock.tick()

    img = sensor.snapshot()
    # 美化。
    img.to_rainbow(color_palette=palette, hint=image.ROTATE_180)
    # 清理噪声。
    img.erode(1)

    blobs = img.find_blobs(
        [(0, 0)], invert=True, pixels_threshold=10, area_threshold=10, merge=False
    )

    for blob in blobs:
        img.draw_rectangle(blob.rect(), color=(0, 255, 0))

    print(clock.fps())

results matching ""

    No results matching ""