【文件属性】:
文件名称:opencv4.2.0无需编译
文件大小:63.9MB
文件格式:RAR
更新时间:2023-06-24 03:25:08
NON-FREE opencv
OPENCV4.2.0包括了non-free,可以做特征相关的算法。以下是程序。
#include "opencv2/opencv.hpp"
void main()
{
cv::Mat lenaImg = cv::imread("G:\\1.bmp");
cv::Mat lenaImg2 = cv::imread("G:\\2.bmp");
auto akaze_detector = AKAZE::create();
vector kpts_01, kpts_02;
Mat descriptors1, descriptors2;
akaze_detector->detectAndCompute(lenaImg, Mat(), kpts_01, descriptors1);
akaze_detector->detectAndCompute(lenaImg2, Mat(), kpts_02, descriptors2);
// 定义描述子匹配 - 暴力匹配
Ptr matcher = DescriptorMatcher::create(DescriptorMatcher::BRUTEFORCE);
std::vector< DMatch > matches;
matcher->match(descriptors1, descriptors2, matches);
// 绘制匹配
Mat img_matches;
drawMatches(lenaImg, kpts_01, lenaImg2, kpts_02, matches, img_matches);
imshow("AKAZE-Matches", img_matches);
imwrite("D://result.png", img_matches);
waitKey(0);
}