find_apriltags.py

# この作品はMITライセンスの下で提供されています。
# Copyright (c) 2013-2023 OpenMV LLC. 全著作権所有。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# AprilTags の例
#
# この例は、OpenMV CamがAprilTagを検出する能力を示します
# OpenMV Cam M7 で動作します。M4 バージョンは April Tags を検出できません。

import csi
import time
import math

csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize(csi.QQVGA)
csi0.snapshot(time=2000)
csi0.auto_gain(False)  # 画像の白飛びを防ぐため、これをオフにする必要があります……
csi0.auto_whitebal(False)  # 画像の白飛びを防ぐため、これをオフにする必要があります……

clock = time.clock()

# 注意! find_qrcodes と異なり、find_apriltags メソッドは動作させるために画像のレンズ補正を必要としません。

# このスクリプトには TAG36H11 タグファミリーを使用してください。これは推奨されるタグファミリーです。


while True:
    clock.tick()
    img = csi0.snapshot()
    for tag in img.find_apriltags():
        img.draw_detection(tag, color1=(255, 0, 0), color2=(0, 255, 0))
        print_args = (tag.name, tag.id, (180 * tag.rotation) / math.pi)
        print("Tag Family %s, Tag ID %d, rotation %f (degrees)" % print_args)
    print(clock.fps())

results matching ""

    No results matching ""