fixed problem with incorrect distance values returned by FlannBasedMatcher for hamming metric (int's were interpreted as floats)

pull/13383/head
Alexander Mordvintsev 14 years ago
parent 8b23c79294
commit 0ad1d0afac
  1. 7
      modules/features2d/src/matchers.cpp

@ -803,7 +803,12 @@ void FlannBasedMatcher::convertToDMatches( const DescriptorCollection& collectio
{
int imgIdx, trainIdx;
collection.getLocalIdx( idx, imgIdx, trainIdx );
matches[i].push_back( DMatch( i, trainIdx, imgIdx, std::sqrt(dists.at<float>(i,j))) );
float dist = 0;
if (dists.type() == CV_32S)
dist = static_cast<float>( dists.at<int>(i,j) );
else
dist = std::sqrt(dists.at<float>(i,j));
matches[i].push_back( DMatch( i, trainIdx, imgIdx, dist ) );
}
}
}

Loading…
Cancel
Save