From a067f1369e5647229760de16fd0085b8b3841df6 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Sat, 22 Nov 2014 16:44:42 +0000 Subject: [PATCH] VWDictionary: Ignore kdtree strategy when RTAB-Map is not build with OpenCV nonfree module Updated parameter LccReextract/MaxWords=600 git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@2072 f169173b-cf89-36c8-b27e-44dbe73f0c83 --- corelib/include/rtabmap/core/Parameters.h | 2 +- corelib/src/VWDictionary.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/corelib/include/rtabmap/core/Parameters.h b/corelib/include/rtabmap/core/Parameters.h index 84999bb4..83c4cb6c 100644 --- a/corelib/include/rtabmap/core/Parameters.h +++ b/corelib/include/rtabmap/core/Parameters.h @@ -336,7 +336,7 @@ class RTABMAP_EXP Parameters RTABMAP_PARAM(LccReextract, NNType, int, 3, "kNNFlannNaive=0, kNNFlannKdTree=1, kNNFlannLSH=2, kNNBruteForce=3, kNNBruteForceGPU=4."); RTABMAP_PARAM(LccReextract, NNDR, float, 0.7, "NNDR: nearest neighbor distance ratio."); RTABMAP_PARAM(LccReextract, FeatureType, int, 4, "0=SURF 1=SIFT 2=ORB 3=FAST/FREAK 4=FAST/BRIEF 5=GFTT/FREAK 6=GFTT/BRIEF 7=BRISK."); - RTABMAP_PARAM(LccReextract, MaxWords, int, 0, "0 no limits."); + RTABMAP_PARAM(LccReextract, MaxWords, int, 600, "0 no limits."); RTABMAP_PARAM(LccIcp3, Decimation, int, 8, "Depth image decimation."); RTABMAP_PARAM(LccIcp3, MaxDepth, float, 4.0, "Max cloud depth."); diff --git a/corelib/src/VWDictionary.cpp b/corelib/src/VWDictionary.cpp index 9cd17626..33395f48 100644 --- a/corelib/src/VWDictionary.cpp +++ b/corelib/src/VWDictionary.cpp @@ -53,7 +53,7 @@ VWDictionary::VWDictionary(const ParametersMap & parameters) : _newWordsComparedTogether(Parameters::defaultKpNewWordsComparedTogether()), _lastWordId(0), _flannIndex(new cv::flann::Index()), - _strategy(kNNUndef) + _strategy(kNNBruteForce) { this->setNNStrategy((NNStrategy)Parameters::defaultKpNNStrategy()); this->parseParameters(parameters); @@ -222,7 +222,16 @@ void VWDictionary::setNNStrategy(NNStrategy strategy) strategy = kNNBruteForce; } - _strategy = strategy; + if(RTABMAP_NONFREE == 0 && strategy == kNNFlannKdTree) + { + UWARN("KdTree (%d) nearest neighbor is not available because RTAB-Map isn't built " + "with OpenCV nonfree module (KdTree only used for SURF/SIFT features). " + "NN strategy is not modified (current=%d).", (int)kNNFlannKdTree, (int)_strategy); + } + else + { + _strategy = strategy; + } } }