fixed problem with incorrect distance values returned by FlannBasedMatcher for hamming metric (int's were interpreted as floats)
This commit is contained in:
parent
8b23c79294
commit
0ad1d0afac
@ -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…
x
Reference in New Issue
Block a user