opencv学习笔记6

来源:互联网 发布:金蝶会计软件 编辑:程序博客网 时间:2024/06/05 23:56

计算一副图像的SIFT特征,并在图像上显示出来


#include<iostream>#include<opencv2\core\core.hpp>#include<opencv2\highgui\highgui.hpp>#include<opencv2\features2d\features2d.hpp>#include<opencv2\nonfree\nonfree.hpp> //sift特征在这里using namespace std;using namespace cv;int main(){Mat image = imread("1.png",1);if(!image.data){cout<<"no data"<<endl;return 0;}vector<KeyPoint> keypoints;//放置关键点SiftFeatureDetector sift(0.03,10.0);//设置参数//0.03代表特征阀值:用于去除低对比度的关键点//10.0是用于降低直线敏感度的阀值:去除不稳定的边缘响应点sift.detect(image,keypoints);drawKeypoints(image,keypoints,image,Scalar(255,0,0),DrawMatchesFlags::DRAW_RICH_KEYPOINTS);namedWindow("sift");imshow("sift",image);waitKey(0);return 0;}



0 0
原创粉丝点击