代码
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <chrono>
#include <nmmintrin.h>
using namespace std;
using namespace cv;
void find_feature_matches(
Mat &img_1, Mat &img_2,
std::vector<KeyPoint> &keypoints_1,
std::vector<KeyPoint> &keypoints_2,
std::vector<DMatch> &matches
);
int main()
{
cv::String path = "/home/automobile/wcm/img_data" ;
cv::String savedfilename;
std::vector<cv::String> filenames;
cv::glob(path, filenames);
if(filenames.size() == 0){
cout << "No image files[png]" <<endl;
}
chrono::steady_clock::time_point t1 = chrono::steady_clock::now();
Mat img_1, img_2;
vector<KeyPoint> keypoints_1, keypoints_2;
vector<DMatch> good_matches;
find_feature_matches(img_1, img_2, keypoints_1, keypoints_2, good_matches);
cout << "size = " << filenames.size() <<endl;
for(int i = filenames.size(); i > 0; i--){
img_1 = cv::imread(filenames[i]);
cout << "read i = " << i << endl;
img_2 = cv::imread(filenames[i-1]);
cout << "read i+1 = " << i-1 <<endl;
find_feature_matches(img_1, img_2, keypoints_1, keypoints_2, good_matches);
}
chrono::steady_clock::time_point t2 = chrono::steady_clock::now();
chrono::duration<double> time_used_match = chrono::duration_cast<