Image: https://drive.google.com/open?id=1NAfI_h4QxM9vDMCH_gXogWbwQC_OTPwl
Code :
int numberOfFeatures = 500;
float scaleFactor = 1.2F;
int nLevels = 8;
int edgeThreshold = 31;
Mat Q = imread("2.png", IMREAD_GRAYSCALE);
scaleImage(Q);
GaussianFilter(Q);
Ptr<ORB> detector = ORB::create(numberOfFeatures, scaleFactor, nLevels,
edgeThreshold);
std::vector<cv::KeyPoint> keypoints;
cv::Mat queryDescriptors;
detector->detectAndCompute(Q, noArray(), keypoints, queryDescriptors);
// search
Mat trainImage = imread("1.jpg",IMREAD_GRAYSCALE);
detector->detectAndCompute(samples_32f, noArray(), keypoints,
descriptor);
samples_32f = samples_32f.reshape(1, 1);
index = makePtr<cv::flann::Index>(samples_32f,
cv::flann::LshIndexParams(10, 10, 10), cvflann::FLANN_DIST_HAMMING);
int K = 1;
cv::flann::SearchParams params;
cv::Mat dists;
cv::Mat indices;
index->knnSearch(queryDescriptors, indices, dists, K, params);
cerr << "indices" << indices << endl;
cerr << "dists" << dists << endl;
/**
*indices[0]
*dists[61124]
*/
descriptors: https://drive.google.com/open?id=1ElmG4ojuwUUcyMTEBw8fQ2XTiXkgJRIM