首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OpenCV 2.42 FeatureDetector怪胎

OpenCV 2.42 FeatureDetector怪胎
EN

Stack Overflow用户
提问于 2012-10-16 01:04:56
回答 2查看 9.1K关注 0票数 10

我想尝试一下OpenCV 2.4.2中的新类FREAK

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

代码语言:javascript
复制
#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);

}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-12-12 15:54:53

有一个OpenCV example,它展示了如何结合使用FREAK和FAST。

基本说明如下:

代码语言:javascript
复制
FREAK extractor;
BruteForceMatcher<Hamming> matcher;
std::vector<KeyPoint> keypointsA, keypointsB;
Mat descriptorsA, descriptorsB;
std::vector<DMatch> matches;

FAST(imgA,keypointsA,10);
FAST(imgB,keypointsB,10);

extractor.compute( imgA, keypointsA, descriptorsA );
extractor.compute( imgB, keypointsB, descriptorsB );

matcher.match(descriptorsA, descriptorsB, matches);
票数 7
EN

Stack Overflow用户

发布于 2012-10-16 02:13:05

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

因此,您需要将其与可用的检测器之一相结合:快速、ORB、SIFT、SURF、MSER或使用goodFeaturesToTrack函数。

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12900514

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档