Ask Your Question

Revision history [back]

Features2D + Homography Tutorial

Hi,

I'm beginner in OpenCV domain and currently I try to implement the "Features2D + Homography tutorial" in Java with OpenCV3.1 and the supplied Java bindings.

In this code:

//-- Step 3: Matching descriptor vectors using FLANN matcher
FlannBasedMatcher matcher;
std::vector< DMatch > matches;
matcher.match( descriptors_object, descriptors_scene, matches );
double max_dist = 0; double min_dist = 100; 
//-- Quick calculation of max and min distances between keypoints
for( int i = 0; i < descriptors_object.rows; i++ )
{ double dist = matches[i].distance;
    if( dist < min_dist ) min_dist = dist;
    if( dist > max_dist ) max_dist = dist;
}

Why in the for loop they use descriptors_object.rows ? Why not using the matches vector's length ?

And my second question is what exactly contains a descriptors_object/descriptors_scene Mat ? Is it a 2 dimension Mat ? With the same width and height than the image used to create this descriptor ?