• 免费好用的星瞳AI云服务上线!简单标注,云端训练,支持OpenMV H7和OpenMV H7 Plus。可以替代edge impulse。 https://forum.singtown.com/topic/9519
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 使用Apriltag进行3D定位,在其代码内如何实现输出实际位置?我改了一下,失败了,请大佬帮忙看一下。



    • 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
      def classs(translation)
      return 3*translation

      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 = (classs(tag.x_translation()), classs(tag.y_translation()), classs(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())0_1586168453856_d8c8de12c09a1c00d11a8652559bf5d.png



    • 33行后面没有冒号



    • @kidswong999 多谢了,类函数这里引用也没用对,刚刚弄好了。



    • 使用Apriltag 3D定位监测多个二维码坐标时,是不是存在一个二维码坐标覆盖另外一个坐标的问题? 如果是,那该怎么解决?



    • @grnl 每一个新的提问,单独发一个新帖子


    已锁定