本文介绍了OpenCV 2.42 FeatureDetector FREAK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在OpenCV 2.4.2中尝试新类别 FREAK
。
I want to try the new class FREAK
in OpenCV 2.4.2.
特征检测器的接口构造 FREAK
,但是,当然,它不工作。我应该如何修改我的代码以获得结果?
I tried to use common interface of feature detector to construct FREAK
, but,of course, it doesn't work. How should I revise my code to get result?
#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描述符。
FREAK is descriptor only. There is no corresponding feature detector.
因此,您需要将其与其中一个可用的检测器组合:FAST,ORB,SIFT,SURF,MSER或使用 goodFeaturesToTrack
函数。
So you need to combine it with one of the available detectors: FAST, ORB, SIFT, SURF, MSER or use goodFeaturesToTrack
function.
这篇关于OpenCV 2.42 FeatureDetector FREAK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!