Probably you have tried to use KD-Tree or KMeans? They works only for CV_32F descriptors like SIFT or SURF. For binary descriptors like BRIEF\ORB\FREAK you have to use either LSH or Hierarchical clustering index. Or simple bruteforce search. You can manage it automatically, for example like this.
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);