

#include <opencv2/core.hpp> // 包含OpenCV核心功能的头文件
#include <opencv2/imgproc.hpp> // 包含OpenCV图像处理功能的头文件
#include <opencv2/features2d.hpp> // 包含OpenCV特征检测相关功能的头文件
#include <opencv2/highgui.hpp> // 包含OpenCV的GUI功能,如窗口显示的头文件
#include <opencv2/calib3d.hpp> // 包含OpenCV进行相机标定和三维重建功能的头文件
#include <iostream> // 包含标准输入输出流库的头文件
#include <iomanip> // 包含输入输出流格式设置的头文件
using namespace std; // 使用标准命名空间
using namespace cv; // 使用OpenCV命名空间
// 声明帮助函数,该函数会输出使用本程序的方式
static void help(char** argv)
{
cout
<< "This is a sample usage of AffineFeature detector/extractor.\n"
<< "And this is a C++ version of samples/python/asift.py\n"
<< "Usage: " << argv[0] << "\n"
// 以下是该程序的参数说明
<< " [ --feature=<sift|orb|brisk> ] # Feature to use.\n"
<< " [ --flann ] # use Flann-based matcher instead of bruteforce.\n"
<< " [ --maxlines=<number(50 as default)> ] # The maximum number of lines in visualizing the matching result.\n"
<< " [ --image1=<image1(aero1.jpg as default)> ]\n"
<< " [ --image2=<image2(aero3.jpg as default)> ] # Path to images to compare."
<< endl;
}
// 声明计时器函数,用于计算操作的耗时
static double timer()
{
return getTickCount() / getTickFrequency();
}
// 程序的主函数,argc是参数数量,argv是参数列表
int main(int argc, char** argv)
{
vector<String> fileName; // 存储文件名的字符串向量
// 使用OpenCV的命令行解析器解析输入的命令行参数
cv::CommandLineParser parser(argc, argv,
"{help h ||}"
"{feature|brisk|}"
"{flann||}"
"{ma