【我的】opencv3.1中利用SIFT特征及RANSAC筛选进行图像矫正
作者:zcr214 时间:2016年8月23日11:20:06
一、安装opencv_contrib
OpenCV3对OpenCV的模块进行了调整,将开发中与nofree模块放在了OpenCV_contrib中(包含SIFT),gitHub上的官方项目分成了两个,opencv 与 opencv_contrib。所以,要使用sift接口需在opencv3.1基础上,再安装opencv_contrib。
安装具体流程详情见:
http://note.youdao.com/yws/public/redirect/share?id=7140349b9ae4bc80fd7c5009b689d57a&type=false
二、sift特征提取
1.探测特征点
Matinput1=imread("01.jpg",1);
Matinput2=imread("02.jpg",1);
Ptr<xfeatures2d::SIFT>feature=xfeatures2d::SIFT::create();//创建SIFT特征类
vector<KeyPoint>keypoints1;
feature->detect(input1,keypoints1);//检测特征点,检测信息保存在keypoint中
Matoutput1;
drawKeypoints(input1,keypoints1,output1);
vector<KeyPoint>keypoints2;
feature->detect(input2,keypoints2);
Matoutput2;
drawKeypoints<