Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

DescriptorMatcher enable Cross Check

I'm using OpenCV with support for Java Desktop. I'm trying to match key points of two different images with DescriptorMatcher. Then I'm applying the Good Matches check and everything works fine. But I've noticed that exists another methodology to eliminate bad matches, the name of which is Cross Check.

1) Is it possible to activate it on definition of matcher?

I've also tried to create my own function, that performs the Cross Check, but something is wrong my code as it returns only 1 match.

2) What can be wrong in the following code?

DescriptorMatcher matcherknn = DescriptorMatcher.create(DescriptorMatcher.FLANNBASED);
matcherknn.match(d1,d2, matchesknn12);
matcherknn.match(d2,d1, matchesknn21);
List <DMatch> matches12 = matchesknn12.toList();
List <DMatch> matches21 = matchesknn21.toList();
List <DMatch> filteredMatches = new ArrayList<DMatch>();

for( int fk = 0; fk < matches12.size(); fk++ )
    DMatch forward = matches12.get(fk);    
    DMatch backward = matches21.get(forward.trainIdx);
    if( backward.trainIdx != forward.queryIdx ){