logo

无法使用除TAG36H11的其他家族

2025-04-09 13:29
F
kostain
# This work is licensed under the MIT license.
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# AprilTags Example
#
# This example shows the power of the OpenMV Cam to detect April Tags
# on the OpenMV Cam M7. The M4 versions cannot detect April Tags.

import sensor
import time
import math
import image

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time=2000)
sensor.set_auto_gain(False)  # must turn this off to prevent image washout...
sensor.set_auto_whitebal(False)  # must turn this off to prevent image washout...
clock = time.clock()

# Note! Unlike find_qrcodes the find_apriltags method does not need lens correction on the image to work.

# Please use the TAG36H11 tag family for this script - it's the recommended tag family to use.


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

如果需要识别其他家族的apriltag话要怎么操作(此代码会报错:AttributeError: 'module' object has no attribute 'TAG25H9'))

2025-04-09 17:33
I
网红小智智 星瞳科技

需要重新编译固件,添加 IMLIB_ENABLE_APRILTAGS_TAG25H9

https://github.com/openmv/openmv/blob/22cbc5d6bbc286f23b0ea98fc66daf79190e27a4/src/omv/boards/OPENMV4P/imlib_config.h#L98

https://github.com/openmv/openmv/blob/22cbc5d6bbc286f23b0ea98fc66daf79190e27a4/src/omv/boards/OPENMV_RT1060/imlib_config.h#L100