Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

(3.1.0) Detected FAST keypoints offset from image

I just compiled OpenCV 3.1.0 from source on Ubuntu 15.10. I disabled CUDA but kept everything else default.

Detected FAST features do not align with my image. Tellingly, when I rotate my camera, the keypoints move at a speed greater than the camera's rotation.

Here is a video.

    vector<KeyPoint> keypoints_1, keypoints_2;
    FAST(img_1, keypoints_1, 28);
    FAST(img_2, keypoints_2, 28);

    Mat descriptors_1, descriptors_2;
    Ptr<ORB> orb = ORB::create();
    orb->compute( img_1, keypoints_1, descriptors_1 );
    orb->compute( img_2, keypoints_2, descriptors_2 );

    BFMatcher matcher;
    vector<vector<DMatch> > knnMatches;
    matcher.knnMatch(descriptors_1, descriptors_2, knnMatches, 2 );

    vector< DMatch > good_matches;
    for( int i = 0; i < descriptors_1.rows; i++ ) {
      if( knnMatches[i][0].distance / knnMatches[i][1].distance <= 0.9 ) {
          good_matches.push_back( knnMatches[i][0]);
      }
    }

    Mat img_matches;
    drawMatches( img_1, keypoints_1, img_2, keypoints_2,
               good_matches, img_matches, Scalar::all(-1), Scalar::all(-1),
               vector<char>(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS );
    imshow( "Matches", img_matches );

Really looking forward to figuring out how I managed to mess this up... thanks everyone.