BRISK特征匹配

来源:互联网 发布:淘宝网店推广论文 编辑:程序博客网 时间:2024/05/17 02:38

BRISK原理:http://blog.csdn.net/quincuntial/article/details/50462126

/* *@function BRISK_Detect.cpp *@brief 使用BRISK特征检测并匹配目标 *@author ltc *@date 17:16 Thursday,December 3rd,2015*/#include<opencv2\core\core.hpp>#include<opencv2\highgui\highgui.hpp>#include<opencv2\features2d\features2d.hpp>#include<opencv2\calib3d\calib3d.hpp>#include<iostream>using namespace std;using namespace cv;int main(int argc,char* argv[]){Mat queryImage,trainImage;queryImage=imread("4.jpg",IMREAD_COLOR);trainImage=imread("2.jpg",IMREAD_COLOR);vector<KeyPoint> queryKeyPoint,trainKeyPoint;Mat queryDescriptor,trainDescriptor;int thresh=60;int octave=4;float patternScale=1.0f;BRISK briskDetector(thresh,octave,patternScale);briskDetector.detect(queryImage,queryKeyPoint);briskDetector.compute(queryImage,queryKeyPoint,queryDescriptor);briskDetector.detect(trainImage,trainKeyPoint);briskDetector.compute(trainImage,trainKeyPoint,trainDescriptor);drawKeypoints(queryImage,queryKeyPoint,queryImage);drawKeypoints(trainImage,trainKeyPoint,trainImage);imshow("query",queryImage);imshow("train",trainImage);vector<DMatch> matches;BFMatcher matcher(NORM_HAMMING);matcher.match(queryDescriptor,trainDescriptor,matches);Mat image_match;drawMatches(queryImage,queryKeyPoint,trainImage,trainKeyPoint,matches,image_match);imshow("image_match",image_match);waitKey(0);return 0;}

匹配结果:


0 0