【问题标题】:How can i get more inliers when using ransac?使用 ransac 时如何获得更多内点?
【发布时间】:2019-11-12 09:32:21
【问题描述】:
matches = sorted(matches, key = lambda x: x.distance)
src_pts = np.float32([ kp1[m.queryIdx].pt for m in matches ]).reshape(-1,1,2)
dst_pts = np.float32([ kp2[m.trainIdx].pt for m in matches ]).reshape(-1,1,2)
M, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC,5.0)
matchesMask = mask.ravel().tolist()

我使用matchesMask 中的值作为被证明受ransac 严重影响的内点,我试图只从匹配中取出前100 个最佳匹配,但异常值的百分比仍然太高。

【问题讨论】:

    标签: python matching homography ransac


    【解决方案1】:

    cv2.findHomography 如果源点与目标投影之间的距离大于ransacReprojThreshold(在您的代码中为 5.0),则将点对视为内点:

    norm(src_pts[i] - M * dst_pts[i]) > ransacReprojThreshold
    

    ransacReprojThreshold - 将点对视为内点时允许的最大重投影误差。

    所以,如果你想找到 100 个“最佳”匹配,即使它的重投影误差超过 5.0:

    1. 创建一个对数组:(点对和重投影误差),
    2. 按重投影错误排序,
    3. 以最小的重投影误差取 100 分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-23
      • 2018-04-09
      • 2017-08-11
      • 2019-08-28
      • 1970-01-01
      • 1970-01-01
      • 2012-11-15
      相关资源
      最近更新 更多