Question

I'm using Opencv C++, for a face recognition application. For that I used SURF as descriptor and FlannMatcher for matching the points. My code is as follows,

FlannBasedMatcher matcher;  
std::vector< DMatch > matches;  
matcher.match( descriptors_1, descriptors_2, matches );

double max_dist = 0; double min_dist = 100;
for( int i = 0; i < descriptors_1.rows; i++ )
{ 
     double dist = matches[i].distance; 
     if( dist < min_dist ) min_dist = dist;
     if( dist > max_dist ) max_dist = dist;
}

Here we are finding min_dist and max_dist for checking whether there is a match between two faces.But I don't understand what this min_dist and max_dist means.

What this exactly means? Why we need to find both min_dist and max_dist for a single descriptor?

Was it helpful?

Solution

As you know SIFT descriptor is a vector in a high dimensional space, i.e 128. As you run it on the image to find interest points, it will find some points as interest points and their descriptor as a vector for each to describe this point in a high dimensional space.

Each of these points in the first image, say A, should have a corresponding in the other image, say B! It means that, those who have a smallest distance are the most likely to be correspondent, But Not all of them. Some of them may be outliers that we expect to have a high distance value in its detected correspondence.That makes us to use max_dsist in our code. In some types of contexts you may not want all the best matches because the number of correspondence points are maybe relatively high, or .... So we define a lower bound on the distance that we do that with min_dist.

I hope that gives you the insight!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top