我正在开发一个应用程序,它涉及Freak描述符的使用,它刚刚在OpenCV2.4.2版本中发布。
在documentation中只有两个函数出现:
selectPairs()我想使用自己的检测器,然后调用异常描述符,传递检测到的关键点,但我不清楚类是如何工作的。
问题:
我严格地需要使用selectPairs()吗?打电话给FREAK.compute()就足够了吗?我真的不明白selectPairs的用途是什么。
发布于 2012-09-20 09:35:04
刚刚浏览了一下论文,在第4.2段中看到,作者建立了一种方法来选择要在描述符中计算的接受字段对,因为采取所有可能的对都会带来太大的负担。selectPairs()函数允许您重新计算这组对。
阅读后面的文档,在这些文档中,它们准确地指向了原始文章中的这个段落。另外,文档中的一些注释告诉您,已经有一组可用的离线学习的对,可以与异常描述符一起使用。因此,我想至少在一开始,您可以只使用预先计算的对,并将从方法中获得的KeyPoints列表作为参数传递给FREAK.compute。
如果您的结果是否定的,您可以尝试在原始论文中使用的keypoint选择方法(第2.1段),然后最终学习您自己的一组对。
发布于 2012-09-19 17:10:54
#include "iostream"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "cv.h"
#include "highgui.h"
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/nonfree/features2d.hpp>
#include <opencv2/flann/flann.hpp>
#include <opencv2/legacy/legacy.hpp>
#include <vector>
using namespace cv;
using namespace std;
int main()
{
Mat image1,image2;
image1 = imread("C:\\lena.jpg",0);
image2 = imread("C:\\lena1.bmp",0);
vector<KeyPoint> keypointsA,keypointsB;
Mat descriptorsA,descriptorsB;
std::vector<DMatch> matches;
OrbFeatureDetector detector(400);
FREAK extractor;
BruteForceMatcher<Hamming> matcher;
detector.detect(image1,keypointsA);
detector.detect(image2,keypointsB);
extractor.compute(image1,keypointsA,descriptorsA);
extractor.compute(image2,keypointsB,descriptorsB);
matcher.match(descriptorsA, descriptorsB, matches);
int nofmatches = 30;
nth_element(matches.begin(),matches.begin()+nofmatches,matches.end());
matches.erase(matches.begin()+nofmatches+1,matches.end());
Mat imgMatch;
drawMatches(image1, keypointsA, image2, keypointsB, matches, imgMatch);
imshow("matches", imgMatch);
waitKey(0);
return 0;
}这是一个简单的应用程序,用于匹配两幅图像中的点.我使用Orb来检测关键点,并将其作为keypoints...then蛮力增强的描述符来检测两幅图像中的对应点.我已经获得了具有最佳match...hope的前30点,这在一定程度上帮助了您.
https://stackoverflow.com/questions/12491022
复制相似问题