Detecting garbage homographies from findHomography in OpenCV?

前端 未结 3 681
自闭症患者
自闭症患者 2020-12-07 19:23

I\'m using findHomography on a list of points and sending the result to warpPerspective.

The problem is that sometimes the result is comple

3条回答
  •  囚心锁ツ
    2020-12-07 19:47

    Understanding the degenerate homography cases is the key. You cannot get a good homography if your points are collinear or close to collinear, for example. Also, huge gray squares may indicate extreme scaling. Both cases may arise from the fact that there are very few inliers in your final homography calculation or the mapping is wrong.

    To ensure that this never happens:
    1. Make sure that points are well spread in both images.
    2. Make sure that there are at least 10-30 correspondences (4 is enough if noise is small).
    3. Make sure that points are correctly matched and the transformation is a homography.

    To find bad homographies apply found H to your original points and see the separation from your expected points that is |x2-H*x1| < Tdist, where Tdist is your threshold for distance error. If there are only few points that satisfy this threshold your homography may be bad and you probably violated one of the above mentioned requirements.

提交回复
热议问题