Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The wrong results mean that somehow the matches were not very good so the resulting homography estimated based on those matches does not make sense. You have to somehow improve your matches, but that is easier said than done. You could start by trying to use ORB instead of SURF, it might give you better results. At least it will certainly be faster to process.

The wrong results mean that somehow the matches were not very good so the resulting homography estimated based on those matches does not make sense. You have to somehow improve your matches, but that is easier said than done. You could start by trying to use ORB instead of SURF, it might give you better results. At least it will certainly be faster to process.

EDIT:

Try to be less strict on what you consider to be "good matches". That would be this line:

if( matches[i].distance < 2*min_dist )

This means that findHomography will have more points to use: processing will be slower but your chances of having a good homography might increase.