find_apriltags_max_res.py
# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# AprilTags最大分辨率示例
#
# 本示例展示OpenMV Cam检测AprilTags的强大能力
# 在OpenMV Cam M7上。M4版本无法检测April标签。
import csi
import time
import math
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.GRAYSCALE)
csi0.framesize(csi.VGA)
# AprilTags 最多处理 64K 像素。
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=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())