2

I want to extract FAST features, based on Features2D + Homography to find a known object

  SurfFeatureDetector detector( minHessian );

  std::vector<KeyPoint> keypoints_object, keypoints_scene;

  detector.detect( img_object, keypoints_object );
  detector.detect( img_scene, keypoints_scene );

  //-- Step 2: Calculate descriptors (feature vectors)
  SurfDescriptorExtractor extractor;

The classes SurfFeatureDetector and FastFeatureDetector are inherited from Detector and can be exchanged. But I couldn't find a matching class for SurfDescriptorExtractor I expected to find something like FastDescriptorExtractor but a class like this isn't available. What seems to be strange is that if I only change the Detector to FastFeatureDetector the example seems to work correctly.

My question is: How should the above sequence look like for Fast features?

stacker
  • 68,052
  • 28
  • 140
  • 210

1 Answers1

8

To my knowledge, there is no FAST feature extractor in OpenCV. Unlike SURF, which can be used for both feature detection and feature vector computation, FAST is mainly used for detecting feature points. After getting feature points, you need to use some other feature extractor to generate feature vectors and do the matching. Alternatively, if you are concern about speed, in OpenCV 2.3, ORB feature is introduced, which actually uses multi-scale FAST (plus some Harris corner measurement) as its detector. The usage is similar to SURF:

OrbFeatureDetector detector(n_features);

OrbDescriptorExtractor extractor(patch_size);

You would need to change the matcher in the example to some Hamming distance based matcher. Hope this helps.

cxyzs7
  • 1,227
  • 8
  • 15
  • Here is the original paper: http://www.willowgarage.com/sites/default/files/orb_final.pdf. And here is the documentation for ORB feature: http://opencv.itseez.com/modules/features2d/doc/feature_detection_and_description.html#orb – cxyzs7 Mar 31 '12 at 03:47
  • 1
    The line to replace based on sample code is `//FlannBasedMatcher matcher;` change to `BruteForceMatcher matcher;` – stacker Apr 03 '12 at 06:15
  • 1
    That is the right change. However, `BruteForceMatcher` is a little bit slow, the best matcher should be LSH based approach, which is not implemented in OpenCV yet. You can try the `LshMatcher` from [here](https://code.ros.org/trac/wg-ros-pkg/browser/branches/trunk_diamondback/stacks/object_recognition_experimental/rbrief/src/lsh.cpp), which is pretty much similar to BruteForceMatcher or FlannMatcher. – cxyzs7 Apr 03 '12 at 06:29