c – OpenCV 2.42 FeatureDetector FREAK

前端之家收集整理的这篇文章主要介绍了c – OpenCV 2.42 FeatureDetector FREAK前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在OpenCV 2.4.2中尝试新的FREAK.

我试图使用特征检测器的通用接口构造FREAK,但是当然不起作用.我应该如何修改代码以获得结果?

  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <opencv\cxcore.h>
  4. #include <opencv2\nonfree\features2d.hpp>
  5. #include <opencv\highgui.h>
  6. #include <opencv2\features2d\features2d.hpp>
  7. #include <vector>
  8.  
  9. using namespace std;
  10. using namespace cv;
  11.  
  12. int main(){
  13. Mat mat1;
  14. mat1 = imread("Testimg06.jpg",0);
  15. vector<KeyPoint> P1;
  16. Ptr<FeatureDetector> freakdes;
  17. Ptr<DescriptorExtractor> descriptorExtractor;
  18. freakdes = FeatureDetector::create("FREAK");
  19.  
  20. freakdes->detect(mat1,P1);
  21.  
  22. Mat keypoint_img;
  23.  
  24. drawKeypoints( mat1,P1,keypoint_img,Scalar::all(-1),DrawMatchesFlags::DEFAULT );
  25. imshow("Keypoints 1",keypoint_img );
  26. cvWaitKey(0);
  27.  
  28. }

解决方法

FREAK只是描述符.没有相应的特征检测器.

所以您需要将其与其中一个可用的检测器:FAST,ORB,SIFT,SURF,MSER或使用goodFeaturesToTrack功能相结合.

猜你在找的C&C++相关文章