genx320_histogram_mode_grayscale_led_tracking.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2024 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 本示例展示了使用Prophesee的GenX320事件传感器追踪带有LED的主动标记点。
# 传感器参数(偏置)经过调整,仅能检测高频调制的高对比度LED。
# 在此设置下,传感器不会检测场景中除LED外的任何低对比度变化,
# 从而实现高效且稳健的LED追踪。
# Prophesee主动标记板上的LED及其对应的事件数据如图所示
# https://youtu.be/j-LpkDpCxUU?si=jA3B4xZg9RHlyoW3

import csi
import time

csi0 = csi.CSI(cid=csi.GENX320)
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize((320, 320))
csi0.brightness(128)  # 一般保持128(这是默认值)。
csi0.contrast(16)  # 增大可让图像更醒目。
csi0.framerate(200)
# 应用针对带LED的主动标记跟踪而调优的传感器偏置
csi0.ioctl(csi.IOCTL_GENX320_SET_BIASES, csi.GENX320_BIASES_ACTIVE_MARKER)

clock = time.clock()

while True:
    clock.tick()

    img = csi0.snapshot()

    blobs = img.find_blobs(
        [(120, 140)], invert=True, pixels_threshold=2, area_threshold=4, merge=True
    )

    for blob in blobs:
        img.draw_detection(blob, color1=(255, 255, 255), color2=(0, 0, 0))

    print(clock.fps())

results matching ""

    No results matching ""