grayscale_color_tracking.py

# この作品はMITライセンスの下で提供されています。
# Copyright (c) 2013-2024 OpenMV LLC. 全著作権所有。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 単一色グレースケールブロブ追跡の例
#
# この例では、FLIR Bosonを使用したOpenMV Camで単一色のグレースケールトラッキングを行う方法を示します。

import csi
import time

# カラートラッキングのしきい値(Grayscale Min, Grayscale Max)
threshold_list = [(220, 255)]

# センサーを初期化します。
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize(csi.VGA)
csi0.snapshot(time=5000)

clock = time.clock()

# ピクセル数が"pixel_threshold"より多く、面積が"area_threshold"より大きいブロブのみが
# 以下の"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, color1=127)
    print(clock.fps())

results matching ""

    No results matching ""