findHomography is giving wrong results

asked 2013-05-29 04:02:55 -0500

alesfranek gravatar image

updated 2013-06-05 03:48:06 -0500

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:

image description

edit retag flag offensive close merge delete

Comments

ransac when there are many outliere isn't able to filter them... there isnt much you can do about it.

yes123 gravatar imageyes123 ( 2013-05-29 23:00:14 -0500 )edit

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.

alesfranek gravatar imagealesfranek ( 2013-06-04 11:19:11 -0500 )edit

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").

Guanta gravatar imageGuanta ( 2013-06-05 05:26:25 -0500 )edit