我想在OpenCV 2.4.2中尝试新的FREAK.
我试图使用特征检测器的通用接口构造FREAK,但是当然不起作用.我应该如何修改代码以获得结果?
- #include <stdio.h>
- #include <iostream>
- #include <opencv\cxcore.h>
- #include <opencv2\nonfree\features2d.hpp>
- #include <opencv\highgui.h>
- #include <opencv2\features2d\features2d.hpp>
- #include <vector>
- using namespace std;
- using namespace cv;
- int main(){
- Mat mat1;
- mat1 = imread("Testimg06.jpg",0);
- vector<KeyPoint> P1;
- Ptr<FeatureDetector> freakdes;
- Ptr<DescriptorExtractor> descriptorExtractor;
- freakdes = FeatureDetector::create("FREAK");
- freakdes->detect(mat1,P1);
- Mat keypoint_img;
- drawKeypoints( mat1,P1,keypoint_img,Scalar::all(-1),DrawMatchesFlags::DEFAULT );
- imshow("Keypoints 1",keypoint_img );
- cvWaitKey(0);
- }
解决方法
FREAK只是描述符.没有相应的特征检测器.
所以您需要将其与其中一个可用的检测器:FAST,ORB,SIFT,SURF,MSER或使用goodFeaturesToTrack功能相结合.