导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. idvq
    I
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    idvq

    @idvq

    0
    声望
    1
    楼层
    207
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    idvq 关注

    idvq 发布的帖子

    • 官方的特征点检测例程,已经记录到特征点,但是感觉识别率还是不高怎么回事??

      利用特征点检测特定物体例程。

      向相机显示一个对象,然后运行该脚本。 一组关键点将被提取一次,然后

      在以下帧中进行跟踪。 如果您想要一组新的关键点,请重新运行该脚本。

      注意:请参阅文档以调整find_keypoints和match_keypoints。

      import sensor, time, image

      Reset sensor

      sensor.reset()

      Sensor settings

      sensor.set_framesize(sensor.VGA)
      sensor.set_windowing((320, 240))
      sensor.set_pixformat(sensor.GRAYSCALE)

      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False)

      #画出特征点
      def draw_keypoints(img, kpts):
      if kpts:
      print(kpts)
      img.draw_keypoints(kpts)
      img = sensor.snapshot()
      time.sleep_ms(1000)

      kpts1 = None
      #kpts1保存目标物体的特征,可以从文件导入特征,但是不建议这么做。
      #kpts1 = image.load_descriptor("/desc.orb")
      #img = sensor.snapshot()
      #draw_keypoints(img, kpts1)

      clock = time.clock()

      while (True):
      clock.tick()
      img = sensor.snapshot()
      if (kpts1 == None):
      kpts1 = img.find_keypoints(max_keypoints=150, threshold=10, scale_factor=1.2)
      draw_keypoints(img, kpts1)#画出此时的目标特征
      else:
      kpts2 = img.find_keypoints(max_keypoints=150, threshold=10, normalized=True)
      #如果检测到特征物体
      if (kpts2):
      #匹配当前找到的特征和最初的目标特征的相似度
      match = image.match_descriptor(kpts1, kpts2, threshold=85)
      #match.count()是kpt1和kpt2的匹配的近似特征点数目。
      #如果大于10,证明两个特征相似,匹配成功。
      if (match.count()>10):
      #在匹配到的目标特征中心画十字和矩形框。
      img.draw_rectangle(match.rect())
      img.draw_cross(match.cx(), match.cy(), size=10)
      #match.theta()是匹配到的特征物体相对目标物体的旋转角度。
      print(kpts2, "matched:%d dt:%d"%(match.count(), match.theta()))

      # Draw FPS
      #打印帧率。
      img.draw_string(0, 0, "FPS:%.2f"%(clock.fps()))
      
      请在这里粘贴代码
      
      发布在 OpenMV Cam
      I
      idvq