问题描述
openCVs flannBasedMatcher使用哪个距离函数,是否可以更改默认值?在Muja和Lowe的原始flann的用户手册中,有一些不同的距离类型(flann_distance_t),我在opencv中看不到更改它们的方法:-/
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 :-/
推荐答案
这在openCV的代码中很少记录,但是在这两个函数中找到了flannBasedMatcher的默认设置
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个检查,0,sorted = trueflann :: KDTreeIndexParams(); //使用4个随机的KD树
flann::SearchParams(); //32 checks, 0, sorted=trueflann::KDTreeIndexParams(); //uses 4 randomized KD trees
默认情况下,距离函数为FLANN_DIST_L2.
The distance function by default is FLANN_DIST_L2.
我认为这段代码说明了为什么您还不能更改它 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"); \
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"); \
这篇关于FlannBasedMatcher使用哪个距离函数以及如何更改它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!