From bcc74f4a8095174a8c5b916c0ce75ea95535dba5 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Fri, 7 Aug 2015 23:29:52 -0400 Subject: [PATCH] issue #5: select default detector/descriptor if a not available one is set in config --- src/Settings.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/Settings.cpp b/src/Settings.cpp index 2039da9a..e2781999 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -643,6 +643,38 @@ Feature2D * Settings::createKeypointDetector() } #endif +#if CV_MAJOR_VERSION < 3 + if(strategies.at(index).compare("AGAST") == 0 || + strategies.at(index).compare("KAZE") == 0 || + strategies.at(index).compare("AKAZE") == 0) + { + index = Settings::defaultFeature2D_1Detector().split(':').first().toInt(); + UERROR("Find-Object is built with OpenCV 2 so " + "AGAST/KAZE/AKAZE cannot be used! Using default \"%s\" instead.", + strategies.at(index).toStdString().c_str()); + + } +#else + if(strategies.at(index).compare("Dense") == 0) + { + index = Settings::defaultFeature2D_1Detector().split(':').first().toInt(); + UERROR("Find-Object is built with OpenCV 3 so " + "Dense cannot be used! Using default \"%s\" instead.", + strategies.at(index).toStdString().c_str()); + + } +#ifndef HAVE_OPENCV_XFEATURES2D + if(strategies.at(index).compare("Star") == 0) + { + index = Settings::defaultFeature2D_1Detector().split(':').first().toInt(); + UERROR("Find-Object is not built with OpenCV xfeatures2d module so " + "Star cannot be used! Using default \"%s\" instead.", + strategies.at(index).toStdString().c_str()); + + } +#endif +#endif + if(strategies.at(index).compare("Dense") == 0) { #if CV_MAJOR_VERSION < 3 @@ -947,6 +979,33 @@ Feature2D * Settings::createDescriptorExtractor() } #endif +#if CV_MAJOR_VERSION < 3 + if(strategies.at(index).compare("KAZE") == 0 || + strategies.at(index).compare("AKAZE") == 0) + { + index = Settings::defaultFeature2D_2Descriptor().split(':').first().toInt(); + UERROR("Find-Object is built with OpenCV 2 so " + "KAZE/AKAZE cannot be used! Using default \"%s\" instead.", + strategies.at(index).toStdString().c_str()); + + } +#else +#ifndef HAVE_OPENCV_XFEATURES2D + if(strategies.at(index).compare("Brief") == 0 || + strategies.at(index).compare("FREAK") == 0 || + strategies.at(index).compare("LUCID") == 0 || + strategies.at(index).compare("LATCH") == 0 || + strategies.at(index).compare("DAISY") == 0) + { + index = Settings::defaultFeature2D_2Descriptor().split(':').first().toInt(); + UERROR("Find-Object is not built with OpenCV xfeatures2d module so " + "Brief/FREAK/LUCID/LATCH/DAISY cannot be used! Using default \"%s\" instead.", + strategies.at(index).toStdString().c_str()); + + } +#endif +#endif + if(strategies.at(index).compare("Brief") == 0) { #if CV_MAJOR_VERSION < 3