So I'm making an application with the use of FAST detectors and FREAK descriptors. When it comes to the matching I wanted to use the BRUTEFORCE_HAMMING matching, but I don't get the expected results (gives more matches with images that have nothing to do with the original, then images that look alike)
I tried the following code
MatOfDMatch matches = new MatOfDMatch();
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
matcher.match(descriptors,descriptors1,matches);
MatOfDMatch goedematches = new MatOfDMatch();
double max_dist = 0;
double min_dist = 100;
//if (descriptors.cols() == descriptors1.cols())
//{
for( int i = 0; i < descriptors.rows(); i++ )
{ double dist = matches.toArray()[i].distance;
if( dist < min_dist ) min_dist = dist;
if( dist > max_dist ) max_dist = dist;
}
// should only draw good matches
for( int i = 0; i < descriptors.rows(); i++ )
{ MatOfDMatch temp = new MatOfDMatch();
if( matches.toArray()[i].distance <= 2*min_dist )
{ temp.fromArray(matches.toArray()[i]);
goedematches.push_back(temp);
}
// }
}
Log.d("LOG!", "Number of good matches= " + goedematches.size());
But it gives back "bad" results. So my question is, are there other methods of doing this matching with FREAK descriptors? (I use the OpenCV Library 2.4.4 and the Java wrapper, so no C-code)
Once you have your descriptors, the brute force approach will give you the closest correspondences you can possibly find since it tries to match a descriptor on the first image against all the descriptors of the second image.
So the answer is no: with FREAK descriptors, the best results you can get (w.r.t the Hamming distance) are those you get with the brute force matching.
(This said, you should get a lot of good and bad matches when the images are similar. Have you tried to draw the matches? Try to draw lines between the matches without using the filtering step.)