Example: 06-April-Tags/find_apriltags_max_res.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# AprilTags Max Res Example
#
# 本示例展示OpenMV Cam检测AprilTags的强大能力
# 在OpenMV Cam M7上。M4版本无法检测April标签。

import sensor
import time
import math
import omv

sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA)

# AprilTags 最多处理 64K 像素。
if omv.board_type() == "H7":
    sensor.set_windowing((240, 240))
elif omv.board_type() == "M7":
    sensor.set_windowing((200, 200))
else:
    raise Exception("You need a more powerful OpenMV Cam to run this script")
sensor.skip_frames(time=2000)
sensor.set_auto_gain(False)  # 必须关闭此功能以防止图像褪色...
sensor.set_auto_whitebal(False)  # 必须关闭此功能以防止图像褪色...
clock = time.clock()

# 注意!与find_qrcodes不同,find_apriltags方法不需要对图像进行镜头校正即可工作。

# 请为此脚本使用TAG36H11标签家族——这是推荐使用的标签家族。


while True:
    clock.tick()
    img = sensor.snapshot()
    for tag in img.find_apriltags():
        img.draw_rectangle(tag.rect, color=127)
        img.draw_cross(tag.cx, tag.cy, color=127)
        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 ""