单色 RGB565 色块跟踪示例
# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2024 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 单色 RGB565 色块跟踪示例
#
# 此示例展示了使用 OpenMV Cam 和 FLIR BOSON 进行单色 RGB565 跟踪。
import csi
import time
import image
# 颜色跟踪阈值(L 最小值,L 最大值,A 最小值,A 最大值,B 最小值,B 最大值)
threshold_list = [(70, 100, -30, 40, 20, 100)]
# 初始化传感器。
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize(csi.VGA)
csi0.color_palette(image.PALETTE_IRONBOW)
csi0.snapshot(time=5000)
clock = time.clock()
# 只有像素数超过“pixel_threshold”且面积超过“area_threshold”的blob才会被
# “find_blobs”返回。如果更改了“pixels_threshold”和“area_threshold”,请进行相应调整。
# 相机分辨率。"merge=True" 合并图像中所有重叠的斑点。
while True:
clock.tick()
img = csi0.snapshot()
for blob in img.find_blobs(
threshold_list, pixels_threshold=200, area_threshold=200, merge=True
):
img.draw_detection(blob)
print(clock.fps())