SURF——绘制特征点

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include<xfeatures2d/nonfree.hpp>
using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;
Mat image;
int main()
{
	image = imread("C:/Users/zhang/Desktop/4.png");
	imshow("原图像", image);
	int Hessian = 400;//海塞矩阵阈值,在这里调整精度,值越大点越少,越精准 
	Ptr<SURF> Detector = SURF::create(Hessian); 
	vector<KeyPoint>  keyPoint;//KeyPoint专门为特征点建立的坐标类型
	Detector->detect(image, keyPoint);//detect寻找特征点的坐标
	Mat point_image;
	drawKeypoints(image, keyPoint, point_image, Scalar::all(-1), DrawMatchesFlags::DEFAULT);//画出特征点
	//Scalar::all(-1)为随机颜色
	imshow("特征点", point_image);

	waitKey(0);
	return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_41721222/article/details/83788498