C++ OpenCV SURF 与 SurfFeatureDetector 与 SurfDescriptorExtractor

C++ OpenCV SURF vs SurfFeatureDetector vs SurfDescriptorExtractor

到目前为止,我使用 cv::SurfFeatureDetector 从图像中获取 SURF 点。现在我也想获得描述符。所以,我认为 cv::SurfDescriptorExtractor 是我需要的。但是,我看到 cv::SurfFeatureDetectorSurfDescriptorExtractor 都可以检测 SURF 点并计算描述符。还有 cv::SURF 可以做同样的事情。这3个有区别吗?

不,没有区别。

你可以在source code中看到它们是一样的:

typedef SURF SurfFeatureDetector;
typedef SURF SurfDescriptorExtractor;

实际上,XXXFeatureDetectorXXXDescriptorExtractor 只是两个独立任务的通用接口,因此您可以将关键点检测与描述符计算分开,例如,您可以使用 MSER 检测关键点并使用 SIFT 计算描述符。


您可以看到 here SURF inherits fromFeature2D`:

class CV_EXPORTS_W SURF : public Feature2D

并且 FeatureDetectorDescriptorExtractorthe same 作为 Feature2D:

typedef Feature2D FeatureDetector;
typedef Feature2D DescriptorExtractor;

FeatureDetectorDescriptorExtractor的区别是:

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.

常见问题 是提取 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.

这种区别对于将查找 关键点 的任务与计算描述符的任务分开很有用,因为并非所有方法都可以做到。例如。 MSER 只是一个特征检测器,但不计算描述符。