const cv::Mat input = cv::imread("lena.jpg", 0); //Load as grayscale
cv::SiftFeatureDetector detector;
//cv::FastFeatureDetector detector;
std::vector<cv::KeyPoint> keypoints;
detector.detect(input, keypoints);
// Add results to image and save.
cv::Mat output;
cv::drawKeypoints(input, keypoints, output);
cv::imwrite("sift_result.jpg", output);
cv::namedWindow("sift_result", CV_WINDOW_AUTOSIZE); //创建窗口
cv::imshow("sift_result", output); //显示图像
cv::waitKey();
return 0;
cv::SiftFeatureDetector detector;
//cv::FastFeatureDetector detector;
std::vector<cv::KeyPoint> keypoints;
detector.detect(input, keypoints);
// Add results to image and save.
cv::Mat output;
cv::drawKeypoints(input, keypoints, output);
cv::imwrite("sift_result.jpg", output);
cv::namedWindow("sift_result", CV_WINDOW_AUTOSIZE); //创建窗口
cv::imshow("sift_result", output); //显示图像
cv::waitKey();
return 0;