minor changes of recall-precision output

This commit is contained in:
Maria Dimashova
2011-05-20 12:14:35 +00:00
parent 2de0e1fc66
commit 983f4f1621
3 changed files with 27 additions and 13 deletions

View File

@@ -491,26 +491,35 @@ void cv::computeRecallPrecisionCurve( const vector<vector<DMatch> >& matches1to2
float cv::getRecall( const vector<Point2f>& recallPrecisionCurve, float l_precision )
{
float recall = -1;
int nearestPointIndex = getNearestPoint( recallPrecisionCurve, l_precision );
float recall = -1.f;
if( nearestPointIndex >= 0 )
recall = recallPrecisionCurve[nearestPointIndex].y;
return recall;
}
int cv::getNearestPoint( const vector<Point2f>& recallPrecisionCurve, float l_precision )
{
int nearestPointIndex = -1;
if( l_precision >= 0 && l_precision <= 1 )
{
int bestIdx = -1;
float minDiff = FLT_MAX;
for( size_t i = 0; i < recallPrecisionCurve.size(); i++ )
{
float curDiff = std::fabs(l_precision - recallPrecisionCurve[i].x);
if( curDiff <= minDiff )
{
bestIdx = (int)i;
nearestPointIndex = (int)i;
minDiff = curDiff;
}
}
recall = recallPrecisionCurve[bestIdx].y;
}
return recall;
return nearestPointIndex;
}
void cv::evaluateGenericDescriptorMatcher( const Mat& img1, const Mat& img2, const Mat& H1to2,