diff --git a/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp b/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp index 907fa21f1..1185de033 100644 --- a/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp +++ b/modules/xfeatures2d/include/opencv2/xfeatures2d.hpp @@ -132,6 +132,8 @@ public: An image descriptor that can be computed very fast, while being about as robust as, for example, SURF or BRIEF. + +@note It requires a color image as input. */ class CV_EXPORTS_W LUCID : public Feature2D { @@ -140,7 +142,7 @@ public: * @param lucid_kernel kernel for descriptor construction, where 1=3x3, 2=5x5, 3=7x7 and so forth * @param blur_kernel kernel for blurring image prior to descriptor construction, where 1=3x3, 2=5x5, 3=7x7 and so forth */ - CV_WRAP static Ptr create(const int lucid_kernel, const int blur_kernel); + CV_WRAP static Ptr create(const int lucid_kernel = 1, const int blur_kernel = 2); }; diff --git a/modules/xfeatures2d/src/lucid.cpp b/modules/xfeatures2d/src/lucid.cpp index 22c5fcd4c..e404f01d3 100644 --- a/modules/xfeatures2d/src/lucid.cpp +++ b/modules/xfeatures2d/src/lucid.cpp @@ -100,12 +100,14 @@ namespace cv { // gliese581h suggested filling a cv::Mat with descriptors to enable BFmatcher compatibility // speed-ups and enhancements by gliese581h void LUCIDImpl::compute(InputArray _src, std::vector &keypoints, OutputArray _desc) { - if (_src.getMat().empty()) + cv::Mat src_input = _src.getMat(); + if (src_input.empty()) return; + CV_Assert(src_input.depth() == CV_8U && src_input.channels() == 3); Mat_ src; - blur(_src.getMat(), src, cv::Size(b_kernel, b_kernel)); + blur(src_input, src, cv::Size(b_kernel, b_kernel)); int x, y, j, d, p, m = (l_kernel*2+1)*(l_kernel*2+1)*3, width = src.cols, height = src.rows, r, c;