OpenCV 3:可用的FeatureDetector :: create()和DescriptorExtractor :: create()选项列表?

时间:2016-04-18 10:13:24

标签: c++ opencv

编辑:我正在查看错误的OpenCV2代码示例,OpenCV3中没有FeatureDetector::create - 这让我感到困惑。

嘿,他是OpenCV的新手,通过拉开其他人的C ++代码来学习。

我想尝试以下所有选项:

detector = FeatureDetector::create(str_detector);
descriptor = DescriptorExtractor::create(str_descriptor);

目前str_detector为FAST,str_descriptor为BRISK

我无法找到可用的探测器和描述符。

有没有办法输出所有当前可用选项的列表?

(我刚刚在全新的linux安装中使用github构建了最新的opencv + opencv-contrib)

我在这里找到了第三方文件列表https://github.com/Itseez/opencv_contrib/tree/master/modules/xfeatures2d/src - 我认为这些是第三个描述符和检测器,因为在某些文件中提到了这些词。但是,拥有一个当前编译/可用选项的完整列表会很高兴。

谢谢!

我自己试着找到答案,然后编辑:

  1. typedef Feature2D FeatureDetector
  2. 中找到typedef Feature2D DescriptorExtractormodules/features2d/include/opencv2/features2d.hpp
  3. 现在挖掘Feature2D ......
  4. 我很困惑,我的C ++让我失望,https://github.com/Itseez/opencv/blob/master/modules/features2d/src/feature2d.cpp
  5. 中没有create
  6. 好,所以只需查看代码(https://github.com/Itseez/opencv/blob/master/modules/features2d/include/opencv2/features2d.hpp
    • BRISK
    • ORB
    • MSER
    • FastFeatureDetector / FAST
    • AgastFeatureDetector / AGAST
    • GFTTDetector
    • SimpleBlobDetector
    • KAZE / AKAZE
  7. 来自contrib代码(https://github.com/Itseez/opencv_contrib/blob/master/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp
    • FREAK
    • StarDetector
    • BriefDescriptorExtractor
    • LUCID
    • LATCH
    • DAISY
    • MSDDetector
  8. 来自nonfree contrib code(https://github.com/Itseez/opencv_contrib/blob/master/modules/xfeatures2d/include/opencv2/xfeatures2d/nonfree.hpp
    • SIFT
    • SURF
  9. 仍然不确定上述哪些可以/应该用于FeatureDetector或DescriptorExtractor

1 个答案:

答案 0 :(得分:8)

您还有OpenCV文档,其中包含OpenCV功能列表:

如果该功能仅在关键点检测或描述符提取中可用,或者两者都是,请阅读文档中链接的相应文章。它还允许对功能进行简要描述(例如,如果它是二进制描述符,主要优点等)。

其他解决方案是测试每个功能:

  • 如果对detect()的调用没问题(没有抛出异常)==>特征检测
  • 如果对compute()的通话是否正常==>特征提取
  • 如果对detectAndCompute()的通话是否正常==>两个
  • 或直接查看源代码。

可能存在更优化的解决方案......

无论如何,据我所知(如果我错了,请随时纠正我):

  • BRISK:探测器+描述符
  • ORB:探测器+描述符
  • MSER:探测器
  • FAST:探测器
  • AGAST:探测器
  • GFFT:探测器
  • SimpleBlobDetector:detector
  • KAZE:探测器+描述符
  • AKAZE:探测器+描述符
  • FREAK:descriptor
  • StarDetector:探测器
  • BriefDescriptorExtractor:descriptor
  • LUCID:descriptor
  • LATCH:descriptor
  • DAISY:descriptor
  • MSDDetector:detector
  • SIFT:探测器+描述符
  • SURF:探测器+描述符

使用OpenCV 3.1时,代码为:

cv::Ptr<cv::Feature2D> kaze = cv::KAZE::create(); 
std::vector<cv::KeyPoint> kpts; 
cv::Mat descriptors; 
kaze->detect(matImg, kpts); 
kaze->compute(matImg, kpts, descriptors); 
kaze->detectAndCompute(matImg, cv::noArray(), kpts, descriptors);

cv::Ptr<cv::Feature2D> daisy = cv::xfeatures2d::DAISY::create(); //Contrib

要知道使用哪种规范类型:

  std::cout << "AKAZE: " << akaze->descriptorType() << " ; CV_8U=" << CV_8U << std::endl;
  std::cout << "AKAZE: " << akaze->defaultNorm() << " ; NORM_HAMMING=" << cv::NORM_HAMMING << std::endl;

最后,为什么

  

No more features2d::create?