From ff8a7b806b57ccd6dadfd2c4e1452a4100aab650 Mon Sep 17 00:00:00 2001 From: Hamdi Sahloul Date: Sun, 7 Jan 2018 14:19:21 +0900 Subject: [PATCH] LUCID - Support RGBA --- modules/xfeatures2d/src/lucid.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/xfeatures2d/src/lucid.cpp b/modules/xfeatures2d/src/lucid.cpp index e404f01d3..dcebfc053 100644 --- a/modules/xfeatures2d/src/lucid.cpp +++ b/modules/xfeatures2d/src/lucid.cpp @@ -100,10 +100,15 @@ 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) { - cv::Mat src_input = _src.getMat(); - if (src_input.empty()) - return; - CV_Assert(src_input.depth() == CV_8U && src_input.channels() == 3); + if (_src.empty()) return; + CV_Assert(_src.depth() == CV_8U); + cv::Mat src_input; + if (_src.channels() == 4) + cvtColor(_src, src_input, COLOR_BGRA2BGR); + else { + CV_Assert(_src.channels() == 3); + src_input = _src.getMat(); + } Mat_ src;