I've been making an application where 2 images can be compared (one on the SD card, one from the camera). There I use a FREAK descriptor on a limited amount of keypoints (i filtered out the 500 best ones according to the response). When I try to match it with BRUTEFORCE_SL2, it gives back 0 matches.
Is this because FREAK and Bruteforce don't work well together? Or did I do something wrong in the code?
Matching happens with
MatOfDMatch matches = new MatOfDMatch();
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_SL2);
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 < 3*min_dist )
{ temp.fromArray(matches.toArray()[i]);
goedematches.push_back(temp);
}
// }
}
Log.d("LOG!", "Number of good matches= " + goedematches.size());
When I just do the matcher.match(descriptors,descriptors1,matches); and read out the matches with Log.d("LOG!", "Number of good matches= " + matches.size()); I get about 450 even if I take a picture of something that doesn't even look like my image.