Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

KeyPoints&DMatch - What distance stands for?

Hey Community,

I don´t understand the parameter distance in the struct DMatch.

There is often the code for get only the "good matches":

double max_dist = 0;
double min_dist = 100;
for( int i = 0; i < descriptors.rows; i++ ){
 double dist = matches[i].distance; 
 if( dist < min_dist ) min_dist = dist; 
 if( dist > max_dist ) max_dist = dist;
}
std::vector< DMatch > good_matches;
for( int i = 0; i < descriptors.rows; i++ ){ 
 if( matches[i].distance <= 2*min_dist ) { 
  good_matches.push_back( matches[i]); 
 }
}

But distance? What is this? It is a float, less than 1. But I can´t get a context between the distance and the pixel to pixel distance.

Say, a DMatch has his query by pixel (25, 50) [first image] and his train by (35, 50) [second image]. For me, the distance would be 10... DMatch.distance is something alá 0.065. And another distance comparison would be pixel (30, 65) and (40, 65). Again 10 pixel but DMatch.distance would be 0.062?!?

Anyone can help me, please?

KeyPoints&DMatch - What does distance stands for?

Hey Community,

I don´t understand the parameter distance in the struct DMatch.

There is often the code for get only the "good matches":

double max_dist = 0;
double min_dist = 100;
for( int i = 0; i < descriptors.rows; i++ ){
 double dist = matches[i].distance; 
 if( dist < min_dist ) min_dist = dist; 
 if( dist > max_dist ) max_dist = dist;
}
std::vector< DMatch > good_matches;
for( int i = 0; i < descriptors.rows; i++ ){ 
 if( matches[i].distance <= 2*min_dist ) { 
  good_matches.push_back( matches[i]); 
 }
}

But distance? What is this? It is a float, less than 1. But I can´t get a context between the distance and the pixel to pixel distance.

Say, a DMatch has his query by pixel (25, 50) [first image] and his train by (35, 50) [second image]. For me, the distance would be 10... DMatch.distance is something alá 0.065. And another distance comparison would be pixel (30, 65) and (40, 65). Again 10 pixel but DMatch.distance would be 0.062?!?

Anyone can help me, please?

KeyPoints&DMatch - What does distance stands for?

Hey Community,

I don´t understand the parameter distance in the struct DMatch.

There is often the code for get only the "good matches":

double max_dist = 0;
double min_dist = 100;
for( int i = 0; i < descriptors.rows; i++ ){
 double dist = matches[i].distance; 
 if( dist < min_dist ) min_dist = dist; 
 if( dist > max_dist ) max_dist = dist;
}
std::vector< DMatch > good_matches;
for( int i = 0; i < descriptors.rows; i++ ){ 
 if( matches[i].distance <= 2*min_dist ) { 
  good_matches.push_back( matches[i]); 
 }
}

But distance? What is this? It is a float, less than 1. But I can´t get a context between the distance and the pixel to pixel distance.

Say, a DMatch has his query by pixel (25, 50) [first image] and his train by (35, 50) [second image]. For me, the distance would be 10... DMatch.distance is something alá 0.065. And another distance comparison would be pixel (30, 65) and (40, 65). Again 10 pixel but DMatch.distance would be 0.062?!?

Anyone can help me, please?