#include<opencv2/opencv.hpp>
#include<iostream>
using namespace cv;
using namespace std;
int main5(int argc, char** argv)
{
Mat src = imread("E:/sift_test.jpg", IMREAD_GRAYSCALE);
if (src.empty())
{
cout << "未能加载图片" << endl;
return -1;
}
namedWindow("input image", CV_WINDOW_AUTOSIZE);
imshow("input image", src);
int numFeatures = 10000;
Ptr<SIFT>detector = SIFT::create(numFeatures);
vector<KeyPoint>keypoints;
detector->detect(src, keypoints, Mat());
cout << "Totol KeyPoints" << keypoints.size() << endl;
Mat keypoint_img;
drawKeypoints(src, keypoints, keypoint_img, Scalar::all(-1), DrawMatchesFlags::DEFAULT);
namedWindow("SIFT KeyPoints", CV_WINDOW_AUTOSIZE);
imshow("SIFT Keypoints",keypoint_img);
waitKey(0);
return 0;
}
C++实现SIFT检测
最新推荐文章于 2023-11-10 10:32:48 发布