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;
}
匹配结果: