Commit 0ad1d0af authored by Alexander Mordvintsev's avatar Alexander Mordvintsev

fixed problem with incorrect distance values returned by FlannBasedMatcher for…

fixed problem with incorrect distance values returned by FlannBasedMatcher for hamming metric (int's were interpreted as floats)
parent 8b23c792
......@@ -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 ) );
}
}
}
......
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