Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I found that getting this all to work is more of an art than a science. One thing that strands out to me is that you don't check how many items you have in good_matches. findHomography() will cause an error if you pass less than 4 points. So you should at least put an if (good_matches.size()>=4) somewhere in there.

In my opinion there's also a bug in FlannBasedMatcher, as the call matcher.match( descriptors_object, descriptors_scene, matches ); should actually be matcher.match( descriptors_scene, descriptors_object, matches ); if you trust the documentation. Except that it would give terrible results.

I found that getting this all to work is more of an art than a science. One thing that strands stands out to me is that you don't check how many items you have in good_matches. findHomography() will cause an error if you pass less than 4 points. So you should at least put an if (good_matches.size()>=4) somewhere in there.

In my opinion there's also a bug in FlannBasedMatcher, as the call matcher.match( descriptors_object, descriptors_scene, matches ); should actually be matcher.match( descriptors_scene, descriptors_object, matches ); if you trust the documentation. Except that it would give terrible results.