#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("1.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;
}
BRISK特征提取与检测
最新推荐文章于 2022-10-23 09:30:00 发布