Which distance function does FlannBasedMatcher use and how to change it?

狂风中的少年 提交于 2019-12-21 17:33:15

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!