opencv3中SURF特征点检测-两幅图像进行比较

#include
#include
#include

using namespace cv;
using namespace std;

int main()
{
	Mat srcImage1 = imread("mofang1.jpg");
	imshow("【原图】", srcImage1);
	Mat srcImage2 = imread("mofang2.jpg");
	imshow("【原图】", srcImage2);

	//首先得到特征点的集合
	//先配置参数
	vector keyPoint1;
	vector keyPoint2;
	//在库中:typedef SURF SurfFeatureDetector;   typedef SURF SurfDescriptorExtractor;所以三者是等价的(别名)
	SURF surf(1000);			//1000为检测算子的阀值
	surf.detect(srcImage1, keyPoint1, Mat());
	surf.detect(srcImage2, keyPoint2, Mat());

	//开始绘制特征点
	Mat dstImage1;
	Mat dstImage2;
	dstImage1.create(srcImage1.size(), srcImage1.type());
	dstImage2.create(srcImage2.size(), srcImage2.type());
	drawKeypoints(srcImage1, keyPoint1, dstImage1
		, Scalar(theRNG().uniform(0, 255), theRNG().uniform(0, 255), theRNG().uniform(0, 255)), 2);
	drawKeypoints(srcImage2, keyPoint2, dstImage2
		, Scalar(theRNG().uniform(0, 255), theRNG().uniform(0, 255), theRNG().uniform(0, 255)), 2);

	imshow("【第一副检测到特征点后的图像】", dstImage1);
	imshow("【第二幅检测到特征点后的图像】", dstImage2);

	waitKey(0);

	return 0;
}

opencv3中SURF特征点检测-两幅图像进行比较_第1张图片

你可能感兴趣的:(opencv学习之路)