Jav*_*ock 17 opencv freak feature-descriptor
我正在开发一个应用程序,它涉及使用刚刚在OpenCV2.4.2版本中发布的Freak描述符.
在文档中只显示两个函数:
类构造函数
一种令人困惑的方法 selectPairs()
我想使用我自己的探测器然后调用FREAK描述符传递检测到的关键点,但我不清楚该类是如何工作的.
题:
我是否严格需要使用selectPairs()?只是打电话就够了FREAK.compute()吗?我真的不明白哪个是selectPairs的用法.
rem*_*emi 18
刚刚翻阅了论文,并在第4.2段中看到作者设置了一种方法来选择要在其描述符中评估的感知字段对,因为采用所有可能的对将是太多的负担.selectPairs()函数允许您重新计算这组对.
之后阅读他们在原始文章中准确指出此段落的文档.此外,文档中的一些注释告诉您,已有可用的离线学习对,可以使用FREAK描述符.所以我想至少在开始时你可以使用预先计算的对,并将你从方法获得的KeyPoints列表作为参数传递给FREAK.compute.
如果您的结果令人失望,您可以尝试原始论文中使用的关键点选择方法(第2.1段),然后最终学习您自己的一对配对.
rot*_*age 16
#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;
}
Run Code Online (Sandbox Code Playgroud)
这是一个简单的应用程序来匹配两个图像中的点...我使用Orb检测关键点和FREAK作为这些关键点上的描述符...然后brutforcematching检测两个图像中的对应点...我已经取得前30分有最好的匹配......希望这对你有所帮助......
| 归档时间: |
|
| 查看次数: |
11544 次 |
| 最近记录: |