星瞳实验室APP,快速收到回复
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • find_apriltags_3d_pose怎么矫正degrees(tag.y_rotation()输出的角度呢?



    • 我使用find_apriltags_3d_pose进行定位,使用的是自带的例程,degrees(tag.y_rotation()输出的角度误差有点大,怎么矫正呢?



    • 效果可以看视频https://singtown.com/learn/49590/

      哪里误差大?



    • Ry测得不太准,角度变化幅度差个10度左右,要用来测偏航角,可以怎么调呢



    • 完全静止的实验结果。

      Tx: -0.876480, Ty -0.875055, Tz -4.575914, Rx 180.150433, Ry 6.354074, Rz 358.055329
      15.73255
      Tx: -0.877966, Ty -0.875999, Tz -4.577111, Rx 180.367575, Ry 6.300081, Rz 357.986689
      15.75533
      Tx: -0.876948, Ty -0.874614, Tz -4.578795, Rx 179.817924, Ry 6.323055, Rz 358.099103
      15.76182
      Tx: -0.876134, Ty -0.869385, Tz -4.583478, Rx 178.142729, Ry 6.134091, Rz 358.320308
      15.75456
      Tx: -0.872988, Ty -0.871366, Tz -4.578303, Rx 178.983712, Ry 6.407222, Rz 358.148885
      15.74803
      Tx: -0.874213, Ty -0.876486, Tz -4.573614, Rx 180.403500, Ry 6.432562, Rz 357.971454
      15.76577
      Tx: -0.877095, Ty -0.876739, Tz -4.577353, Rx 180.513811, Ry 6.425136, Rz 357.979250
      15.77061
      Tx: -0.873796, Ty -0.881208, Tz -4.558734, Rx 182.609558, Ry 6.241501, Rz 357.637358
      15.95007
      Tx: -0.877497, Ty -0.874676, Tz -4.578373, Rx 179.805861, Ry 6.318311, Rz 358.043957
      15.96806
      Tx: -0.871220, Ty -0.874167, Tz -4.573812, Rx 179.940500, Ry 6.470804, Rz 357.929111
      15.94388
      Tx: -0.869778, Ty -0.877163, Tz -4.568369, Rx 181.178083, Ry 6.526481, Rz 357.621717
      15.91187
      Tx: -0.876682, Ty -0.873590, Tz -4.578239, Rx 179.537163, Ry 6.451271, Rz 358.104944
      15.8917
      Tx: -0.878050, Ty -0.873434, Tz -4.582887, Rx 179.837093, Ry 6.664645, Rz 358.078647
      15.87302
      Tx: -0.877403, Ty -0.873518, Tz -4.581779, Rx 179.661536, Ry 6.160123, Rz 358.075213
      15.85566
      Tx: -0.884307, Ty -0.880222, Tz -4.573338, Rx 181.696568, Ry 6.194533, Rz 357.899427
      15.85624
      Tx: -0.880510, Ty -0.878864, Tz -4.579540, Rx 181.230068, Ry 6.757317, Rz 357.888746
      15.87302
      Tx: -0.883886, Ty -0.881483, Tz -4.572171, Rx 182.334385, Ry 6.461762, Rz 357.741356
      15.88089
      Tx: -0.884561, Ty -0.886061, Tz -4.563071, Rx 183.927708, Ry 6.960098, Rz 357.506561
      16.12903
      Tx: -0.881572, Ty -0.887242, Tz -4.557488, Rx 184.484282, Ry 7.110193, Rz 357.402182
      16.80672
      Tx: -0.877879, Ty -0.881150, Tz -4.581673, Rx 181.341944, Ry 7.744792, Rz 358.126998
      16.94915
      Tx: -0.882642, Ty -0.886221, Tz -4.560514, Rx 183.909941, Ry 7.043563, Rz 357.458210
      16.59751
      Tx: -0.884153, Ty -0.885133, Tz -4.566542, Rx 183.425283, Ry 7.175475, Rz 357.485414
      17.60563
      Tx: -0.884453, Ty -0.879402, Tz -4.583936, Rx 180.911770, Ry 6.985199, Rz 357.808566
      17.54386
      Tx: -0.880853, Ty -0.883418, Tz -4.568888, Rx 182.969961, Ry 7.380502, Rz 357.617998
      17.41294
      Tx: -0.887471, Ty -0.882891, Tz -4.581702, Rx 181.851959, Ry 7.895341, Rz 357.690859
      17.13062
      Tx: -0.881699, Ty -0.883692, Tz -4.577967, Rx 182.180204, Ry 8.012682, Rz 357.668471
      17.01323
      Tx: -0.887495, Ty -0.884634, Tz -4.569012, Rx 182.966194, Ry 8.042303, Rz 357.729912
      16.89189
      Tx: -0.878844, Ty -0.879375, Tz -4.572147, Rx 181.462584, Ry 6.389551, Rz 357.814908
      16.71733
      Tx: -0.879639, Ty -0.876852, Tz -4.573839, Rx 180.736942, Ry 6.149974, Rz 357.932377
      16.64355
      Tx: -0.859951, Ty -0.880023, Tz -4.568498, Rx 181.950712, Ry 6.497900, Rz 357.704043
      16.51842
      Tx: -0.876829, Ty -0.882930, Tz -4.555437, Rx 183.461838, Ry 6.577980, Rz 357.517791
      16.47059
      Tx: -0.869249, Ty -0.876673, Tz -4.571870, Rx 180.786037, Ry 6.569314, Rz 357.682490
      16.51982
      Tx: -0.872511, Ty -0.879409, Tz -4.562423, Rx 181.984663, Ry 6.361035, Rz 357.649660
      16.46091
      Tx: -0.875411, Ty -0.876481, Tz -4.568241, Rx 180.968151, Ry 6.093893, Rz 357.897186
      16.42512
      Tx: -0.868971, Ty -0.872772, Tz -4.579243, Rx 179.335451, Ry 6.543279, Rz 357.876039
      16.33394
      Tx: -0.868229, Ty -0.873594, Tz -4.577209, Rx 179.625678, Ry 6.703719, Rz 357.871532
      16.29503
      Tx: -0.870917, Ty -0.875364, Tz -4.576222, Rx 180.201063, Ry 6.540730, Rz 357.832289
      16.27339
      Tx: -0.868719, Ty -0.873341, Tz -4.576048, Rx 179.709458, Ry 6.636948, Rz 357.818413
      16.2917
      


    • 静止没什么问题,是测变化幅度不准,我把tag水平旋转一定角度,他测得的角度变化幅度(Ry变化度数)不对



    • 0_1560579924263_65c8b933-2f01-4c99-85ac-4404874a0249-image.png



    • 0_1560579966336_27a68b1a-a3f7-4459-88cb-3f1ff77690e3-image.png



    • 0_1560580026555_ae8e945a-99ee-442a-92c9-b5e1ed1f37e9-image.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.GRAYSCALE)
      sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger...
      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.
      
      # What's the difference between tag families? Well, for example, the TAG16H5 family is effectively
      # a 4x4 square tag. So, this means it can be seen at a longer distance than a TAG36H11 tag which
      # is a 6x6 square tag. However, the lower H value (H5 versus H11) means that the false positve
      # rate for the 4x4 tag is much, much, much, higher than the 6x6 tag. So, unless you have a
      # reason to use the other tags families just use TAG36H11 which is the default family.
      
      # The AprilTags library outputs the pose information for tags. This is the x/y/z translation and
      # x/y/z rotation. The x/y/z rotation is in radians and can be converted to degrees. As for
      # translation the units are dimensionless and you must apply a conversion function.
      
      # f_x is the x focal length of the camera. It should be equal to the lens focal length in mm
      # divided by the x sensor size in mm times the number of pixels in the image.
      # The below values are for the OV7725 camera with a 2.8 mm lens.
      
      # f_y is the y focal length of the camera. It should be equal to the lens focal length in mm
      # divided by the y sensor size in mm times the number of pixels in the image.
      # The below values are for the OV7725 camera with a 2.8 mm lens.
      
      # c_x is the image x center position in pixels.
      # c_y is the image y center position in pixels.
      
      f_x = (2.8 / 3.984) * 160 # find_apriltags defaults to this if not set
      f_y = (2.8 / 2.952) * 120 # find_apriltags defaults to this if not set
      c_x = 160 * 0.5 # find_apriltags defaults to this if not set (the image.w * 0.5)
      c_y = 120 * 0.5 # find_apriltags defaults to this if not set (the 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): # defaults to TAG36H11
              img.draw_rectangle(tag.rect(), color = (255, 0, 0))
              img.draw_cross(tag.cx(), tag.cy(), color = (0, 255, 0))
              # Translation units are unknown. Rotation units are in degrees.
              img.draw_string(0,0,"Rx %f" % degrees(tag.x_rotation()))
              img.draw_string(0,10,"Ry %f" % degrees(tag.y_rotation()))
              img.draw_string(0,20,"Rz %f" % degrees(tag.z_rotation()))
              img.draw_string(0,90,"Rx %f" % tag.x_translation())
              img.draw_string(0,100,"Ry %f" % tag.y_translation())
              img.draw_string(0,110,"Rz %f" % tag.z_translation())
              #print("Rx %f, Ry %f, Rz %f" % print_args)
          #print(clock.fps())