问题
Which distance function does openCVs flannBasedMatcher use and is it possible to change the default? In the user manual from the original flann by Muja and Lowe there are some different distance types (flann_distance_t) and I don't see a method in opencv to change them :-/
回答1:
This is very poorly documented in the code for openCV but the default settings for the flannBasedMatcher are found in these two functions
flann::SearchParams(); //32 checks, 0, sorted=true flann::KDTreeIndexParams(); //uses 4 randomized KD trees
The distance function by default is FLANN_DIST_L2.
I think this bit of code explains why you can't yet change it
printf("[WARNING] You are using cv::flann::Index (or cv::flann::GenericIndex) and have also changed the distance using cvflann::set_distance_type. This is no longer working as expected cv::flann::Index always uses L2). You should create the index templated on the distance, for example for L1 distance use: GenericIndex< L1<float> > \n"); \
来源:https://stackoverflow.com/questions/10897475/which-distance-function-does-flannbasedmatcher-use-and-how-to-change-it