1.概述
在深度学习出现之前,OpenCV描述符匹配器主要有BFmatcher、descriptionmatcher、
2.理论对比
3.代码实现
#include <iostream>
#include <opencv2/opencv.hpp>int main(int argc, char** argv) {if(argc != 2) {std::cerr << "Usage: " << argv[0] << " <image_path>" << std::endl;return -1;}// Load the imagecv::Mat image = cv::imread(argv[1], cv::IMREAD_GRAYSCALE);if(image.empty()) {std::cerr << "Error: Couldn't read the image. Check the path and try again." << std::endl;return -1;}// Detect FAST keypointsstd::vector<cv::KeyPoint> keypoints;cv::FAST(image, keypoints, 20, true); // 20 is the threshold for FAST// Draw the keypoints on the imagecv::Mat keypointsImage;cv::drawKeypoints(image, keypoints, keypointsImage, cv::Scalar(0, 0, 255), cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);cv::imshow("FAST Keypoints", keypointsImage);// Wait for a key press and then closecv::waitKey(0);return 0;
}