BFMatcher matcher(NORM_L2);
vector matches;
matcher.match(descriptors_1, descriptors_2, matches);
double max_dist = 0; double min_dist = 100; double sum_dist = 0;
//-- Quick calculation of max and min distances between keypoints
for (int k = 0; k < descriptors_1.rows; k++)
{
double dist = matches[k].distance;
sum_dist = sum_dist + dist;
if (sum_dist < min_dist) min_dist = dist;
if (sum_dist > max_dist) max_dist = dist;
}
if (min_dist < mindist)
{
mindist = min_dist;
matchInd = j;
}
↧