findHomography is giving wrong results
I am basically running this tutorial Features2D + Homography to find a known object.
I run cv::findHomography
and visualize only the inliers. It works well and finds a nice rectangle in 99% of the cases so I doubt it is an implementation error. But sometimes the homography is apparently wrong even though the support is sufficient. Is there a chance there is a bug in cv::findHomography
?
I would like to refer to this question c++ - opencv's findHomography produces nonsense results. It seems I am not the only one with such problem..
Here is an example how it look like:
ransac when there are many outliere isn't able to filter them... there isnt much you can do about it.
I know, but what I find weird is that there is clearly a discrepancy between the given homography and the matches voting for the homography (status variable from findHomography) which are drawn. The weirdest thing is that the matches aren't in the green rectangle.
Have you tried different RANSAC parameters. Have you tried LMEDS instead of RANSAC? If nothing helps, code RANSAC yourself, it's actually not very complicated. Another trick to boost RANSAC is to normalize the input data such that it gets zero-mean and its average distance to the center is sqrt(2) (see Hartley & Zisserman "Multiple View Geometry in Computer Vision").