DimChtz DimChtz - 3 months ago 165
C++ Question

C++ OpenCV SURF vs SurfFeatureDetector vs SurfDescriptorExtractor

So far I used

cv::SurfFeatureDetector
to get SURF points from an image. Now I want to get the descriptors as well. So, I thought
cv::SurfDescriptorExtractor
is what I need. But, I saw that both
cv::SurfFeatureDetector
and
SurfDescriptorExtractor
can detect SURF points and compute the descriptors. And there is also
cv::SURF
which can do the same things. Is there any difference between these 3?

Answer

No, there is no difference.

You can see in the source code that they are the same:

typedef SURF SurfFeatureDetector;
typedef SURF SurfDescriptorExtractor;

In practice, XXXFeatureDetector and XXXDescriptorExtractor are simply common interfaces for the 2 separate tasks, so you can separate the keypoints detection from the descriptor computation, and you can for example detect keypoints with MSER and compute descriptors with SIFT.


You can see here that SURF inherits fromFeature2D`:

class CV_EXPORTS_W SURF : public Feature2D

And that FeatureDetector and DescriptorExtractor are the same as Feature2D:

typedef Feature2D FeatureDetector;
typedef Feature2D DescriptorExtractor;

The distinction between FeatureDetector and DescriptorExtractor is:

Feature detectors in OpenCV have wrappers with a common interface that enables you to easily switch between different algorithms solving the same problem. All objects that implement keypoint detectors inherit the FeatureDetector interface.

The common problem is to extract the KeyPoints.

Extractors of keypoint descriptors in OpenCV have wrappers with a common interface that enables you to easily switch between different algorithms solving the same problem. This section is devoted to computing descriptors represented as vectors in a multidimensional space. All objects that implement the vector descriptor extractors inherit the DescriptorExtractor interface.

This distinction is useful to separate the task of finding the keypoints from the task of computing the descriptor, since not all methods can do both. E.g. MSER is just a feature detector, but doesn't compute the descriptors.