find_apriltags.py
# هذا العمل مرخص بموجب ترخيص MIT.
# حقوق النشر (c) 2013-2023 OpenMV LLC. جميع الحقوق محفوظة.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# مثال AprilTags
#
# يوضح هذا المثال قدرة كاميرا OpenMV على اكتشاف علامات April Tags
# على كاميرا 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) # يجب إيقاف تشغيل هذا لمنع تشبع الصورة بالضوء (image washout)...
csi0.auto_whitebal(False) # يجب إيقاف تشغيل هذا لمنع تشبع الصورة بالضوء (image washout)...
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())