Commit b8de8174 authored by moodoki's avatar moodoki

Slight modification to example code for FLANN matcher with comment on #3344

parent a81efdbb
...@@ -81,12 +81,14 @@ This tutorial code's is shown lines below. You can also download it from `here < ...@@ -81,12 +81,14 @@ This tutorial code's is shown lines below. You can also download it from `here <
printf("-- Max dist : %f \n", max_dist ); printf("-- Max dist : %f \n", max_dist );
printf("-- Min dist : %f \n", min_dist ); printf("-- Min dist : %f \n", min_dist );
//-- Draw only "good" matches (i.e. whose distance is less than 2*min_dist ) //-- Draw only "good" matches (i.e. whose distance is less than 2*min_dist,
//-- or a small arbitary value ( 0.02 ) in the event that min_dist is very
//-- small)
//-- PS.- radiusMatch can also be used here. //-- PS.- radiusMatch can also be used here.
std::vector< DMatch > good_matches; std::vector< DMatch > good_matches;
for( int i = 0; i < descriptors_1.rows; i++ ) for( int i = 0; i < descriptors_1.rows; i++ )
{ if( matches[i].distance <= 2*min_dist ) { if( matches[i].distance <= max(2*min_dist, 0.02) )
{ good_matches.push_back( matches[i]); } { good_matches.push_back( matches[i]); }
} }
......
...@@ -65,12 +65,14 @@ int main( int argc, char** argv ) ...@@ -65,12 +65,14 @@ int main( int argc, char** argv )
printf("-- Max dist : %f \n", max_dist ); printf("-- Max dist : %f \n", max_dist );
printf("-- Min dist : %f \n", min_dist ); printf("-- Min dist : %f \n", min_dist );
//-- Draw only "good" matches (i.e. whose distance is less than 2*min_dist ) //-- Draw only "good" matches (i.e. whose distance is less than 2*min_dist,
//-- or a small arbitary value ( 0.02 ) in the event that min_dist is very
//-- small)
//-- PS.- radiusMatch can also be used here. //-- PS.- radiusMatch can also be used here.
std::vector< DMatch > good_matches; std::vector< DMatch > good_matches;
for( int i = 0; i < descriptors_1.rows; i++ ) for( int i = 0; i < descriptors_1.rows; i++ )
{ if( matches[i].distance <= 2*min_dist ) { if( matches[i].distance <= max(2*min_dist, 0.02) )
{ good_matches.push_back( matches[i]); } { good_matches.push_back( matches[i]); }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment