Navigation

    • Login
    • Search
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. Home
    2. 6zoe
    6
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    6zoe

    @6zoe

    0
    Reputation
    3
    Posts
    48
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    6zoe Follow

    Posts made by 6zoe

    • RE: AprilTag标记的代码,在运行后出现如下报错,改怎么办?

      @6zoe 0_1746789737467_屏幕截图 2025-05-09 192210.png

      posted in OpenMV Cam
      6
      6zoe
    • AprilTag标记的代码,在运行后出现如下报错,改怎么办?

      0_1746788793344_屏幕截图 2025-05-09 190619.png

      # 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, image, time, math
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger...
      sensor.skip_frames(30)
      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()
      
      # 注意!与find_qrcodes不同,find_apriltags 不需要软件矫正畸变就可以工作。
      
      # 注意,输出的姿态的单位是弧度,可以转换成角度,但是位置的单位是和你的大小有关,需要等比例换算
      
      # f_x 是x的像素为单位的焦距。对于标准的OpenMV,应该等于2.8/3.984*656,这个值是用毫米为单位的焦距除以x方向的感光元件的长度,乘以x方向的感光元件的像素(OV7725)
      # f_y 是y的像素为单位的焦距。对于标准的OpenMV,应该等于2.8/2.952*488,这个值是用毫米为单位的焦距除以y方向的感光元件的长度,乘以y方向的感光元件的像素(OV7725)
      
      # c_x 是图像的x中心位置
      # c_y 是图像的y中心位置
      
      f_x = (2.8 / 3.984) * 160 # 默认值
      f_y = (2.8 / 2.952) * 120 # 默认值
      c_x = 160 * 0.5 # 默认值(image.w * 0.5)
      c_y = 120 * 0.5 # 默认值(image.h * 0.5)
      
      def degrees(radians):
          return (180 * radians) / math.pi
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          for tag in img.find_apriltags(fx=f_x, fy=f_y, cx=c_x, cy=c_y): # 默认为TAG36H11
              img.draw_rectangle(tag.rect(), color = (255, 0, 0))
              img.draw_cross(tag.cx(), tag.cy(), color = (0, 255, 0))
              print_args = (tag.x_translation(), tag.y_translation(), tag.z_translation(), \
                  degrees(tag.x_rotation()), degrees(tag.y_rotation()), degrees(tag.z_rotation()))
              # 位置的单位是未知的,旋转的单位是角度
              print("Tx: %f, Ty %f, Tz %f, Rx %f, Ry %f, Rz %f" % print_args)
          print(clock.fps())
      
      
      posted in OpenMV Cam
      6
      6zoe
    • AprilTag在运行时,出现如下报错该怎么解决

      0_1746788535439_屏幕截图 2025-05-09 182737.png

      posted in OpenMV Cam
      6
      6zoe