sift算法原理参考下面两篇链接。
http://wenku.baidu.com/view/2e1f33b665ce050876321362.html
论文的原文可见:http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf
OpenCV中使用sift特征的代码如下:
// Read input image
image= cv::imread("../church01.jpg",0);
keypoints.clear();
//
Construct the sift feature detector object
cv::SiftFeatureDetector
sift(
0.03, // feature threshold
10.); // threshold to reduce
//
sensitivity to lines
// Detect the SURF
features
sift.detect(image,keypoints);
cv::drawKeypoints(image,keypoints,featureImage,cv::Scalar(255,255,255),cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
// Display the
corners
cv::namedWindow("SIFT Features");
cv::imshow("SIFT
Features",featureImage);
surf算法可以看作加速的sift算法。原理参考http://wenku.baidu.com/view/1f66acf3f61fb7360b4c65ad.html
opencv中使用surf的代码为:
// Read input
image
cv::Mat image= cv::imread("../church03.jpg",0);
// vector of keypoints
std::vector<cv::KeyPoint>
keypoints;
keypoints.clear();
//
Construct the SURF feature detector object
cv::SurfFeatureDetector surf(2500);
//
Detect the SURF features
surf.detect(image,keypoints);
cv::Mat featureImage;
cv::drawKeypoints(image,keypoints,featureImage,cv::Scalar(255,255,255),cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
// Display the corners
cv::namedWindow("SURF Features");
cv::imshow("SURF
Features",featureImage);
完整代码:工程FirstOpenCV50
OpenCV教程(47) sift特征和surf特征,布布扣,bubuko.com
原文:http://www.cnblogs.com/mikewolf2002/p/3603375.html