fixed build with OpenCV 2.4

This commit is contained in:
matlabbe
2020-11-01 12:49:21 -05:00
parent 99275fba1d
commit 4ecf37a3ab

View File

@@ -2122,29 +2122,21 @@ void GFTT_DAISY::parseParameters(const ParametersMap & parameters)
Parameters::parse(parameters, Parameters::kFREAKPatternScale(), patternScale_); Parameters::parse(parameters, Parameters::kFREAKPatternScale(), patternScale_);
Parameters::parse(parameters, Parameters::kFREAKNOctaves(), nOctaves_); Parameters::parse(parameters, Parameters::kFREAKNOctaves(), nOctaves_);
#if CV_MAJOR_VERSION < 3
_daisy = cv::Ptr<CV_DAISY>(new CV_DAISY());
#else
#ifdef HAVE_OPENCV_XFEATURES2D #ifdef HAVE_OPENCV_XFEATURES2D
_daisy = CV_DAISY::create(); _daisy = CV_DAISY::create();
#else #else
UWARN("RTAB-Map is not built with OpenCV xfeatures2d module so DAISY cannot be used!"); UWARN("RTAB-Map is not built with OpenCV xfeatures2d module so DAISY cannot be used!");
#endif #endif
#endif
} }
cv::Mat GFTT_DAISY::generateDescriptorsImpl(const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints) const cv::Mat GFTT_DAISY::generateDescriptorsImpl(const cv::Mat & image, std::vector<cv::KeyPoint> & keypoints) const
{ {
UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U); UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
cv::Mat descriptors; cv::Mat descriptors;
#if CV_MAJOR_VERSION < 3
_daisy->compute(image, keypoints, descriptors);
#else
#ifdef HAVE_OPENCV_XFEATURES2D #ifdef HAVE_OPENCV_XFEATURES2D
_daisy->compute(image, keypoints, descriptors); _daisy->compute(image, keypoints, descriptors);
#else #else
UWARN("RTAB-Map is not built with OpenCV xfeatures2d module so DAISY cannot be used!"); UWARN("RTAB-Map is not built with OpenCV xfeatures2d module so DAISY cannot be used!");
#endif
#endif #endif
return descriptors; return descriptors;
} }