fixed bug in knnMatch method

This commit is contained in:
Maria Dimashova 2011-04-29 14:12:17 +00:00
parent de93fdb1af
commit e202b13069

View File

@ -264,13 +264,13 @@ void DescriptorMatcher::checkMasks( const vector<Mat>& masks, int queryDescripto
void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, int knn, void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, int knn,
const vector<Mat>& masks, bool compactResult ) const vector<Mat>& masks, bool compactResult )
{ {
matches.clear(); matches.clear();
if( empty() || queryDescriptors.empty() ) if( empty() || queryDescriptors.empty() )
return; return;
CV_Assert( knn > 0 ); CV_Assert( knn > 0 );
checkMasks( masks, queryDescriptors.rows ); checkMasks( masks, queryDescriptors.rows );
train(); train();
knnMatchImpl( queryDescriptors, matches, knn, masks, compactResult ); knnMatchImpl( queryDescriptors, matches, knn, masks, compactResult );
@ -279,13 +279,13 @@ void DescriptorMatcher::knnMatch( const Mat& queryDescriptors, vector<vector<DMa
void DescriptorMatcher::radiusMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, float maxDistance, void DescriptorMatcher::radiusMatch( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, float maxDistance,
const vector<Mat>& masks, bool compactResult ) const vector<Mat>& masks, bool compactResult )
{ {
matches.empty(); matches.clear();
if( empty() || queryDescriptors.empty() ) if( empty() || queryDescriptors.empty() )
return; return;
CV_Assert( maxDistance > std::numeric_limits<float>::epsilon() ); CV_Assert( maxDistance > std::numeric_limits<float>::epsilon() );
checkMasks( masks, queryDescriptors.rows ); checkMasks( masks, queryDescriptors.rows );
train(); train();
radiusMatchImpl( queryDescriptors, matches, maxDistance, masks, compactResult ); radiusMatchImpl( queryDescriptors, matches, maxDistance, masks, compactResult );