Did you try to use KD-Tree or KMeans? They work only for CV_32F descriptors, such as SIFT or SURF. For binary descriptors such as BRIEF \ ORB \ FREAK, you must use either LSH or a hierarchical clustering index. Or just a search for brute force. You can control it automatically, for example, as follows.
cv::flann::Index GenFLANNIndex(cv::Mat keys) { switch (keys.type()) { case CV_32F: { return cv::flann::Index(keys,cv::flann::KDTreeIndexParams(4)); break; } case CV_8U: { return cv::flann::Index(keys,cv::flann::HierarchicalClusteringIndexParams(),dist_type); break; } default: { return cv::flann::Index(keys,cv::flann::KDTreeIndexParams(4)); break; } } } ... cv::flann::Index tree = GenFLANNIndex(descriptors);
old-ufo
source share