Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use the output-mask of findHomography (if you use RANSAC or LMEDS). Afaik the output-mask gives you a mask of inliers/outliers, so count the number of inliers and if they are high enough -> accept otherwise reject the image.

If this ain't working good enough, maybe because you have many differences in the number of inliers than you need to try to add some other verification steps (I assume you're using a feature-matching approach):

  • keep only strong features (cv::KeyPointsFilter::retainBest())
  • Improve your matching by applying cross-check / ratio-check, see http://answers.opencv.org/question/15/how-to-get-good-matches-from-the-orb-feature/
  • Reject them at the end (this depends much on your image content): Warp the 2nd image according to the homography matrix (as you already do it), now apply cross-correlation between the 1st and the warped 2nd image and see how good your cross-correlation is (the cc-map should contain an area of high values when your homography matrix was correct).