介绍
FLANN(Fast Library for Approximate Nearest Neighbors)在一个描述符集合(询问集)中找另一个集合(相当于训练集)的最近邻。
例子
#include <iostream>
#include <vector>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;
int main()
{
Mat img1 = imread("../res/box.png", cv::IMREAD_GRAYSCALE);
Mat img2 = imread("../res/box_in_scene.png", cv::IMREAD_GRAYSCALE);
if(img1.empty()||img2.empty())
{
cout << "can't load image" << endl;
return -1;
}
//计算 keypoints and descriptor
int minHessian = 400;
Ptr<SURF> detector = SURF::create