Freak - convert to gray instead of throwing an error

Similar to other descriptors, if the input image is colored, covert it silently to gray-level rather than terminating the execution
pull/1433/head
Hamdi Sahloul 7 years ago committed by Hamdi Sahloul
parent 53e34260b1
commit be84634c92
  1. 9
      modules/xfeatures2d/src/freak.cpp

@ -333,8 +333,13 @@ void FREAK_Impl::compute( InputArray _image, std::vector<KeyPoint>& keypoints, O
((FREAK_Impl*)this)->buildPattern();
// Convert to gray if not already
Mat grayImage = image;
CV_Assert(grayImage.channels() == 1);
Mat grayImage;
if( image.channels() == 3 || image.channels() == 4 )
cvtColor(image, grayImage, COLOR_BGR2GRAY);
else {
CV_Assert(image.channels() == 1);
grayImage = image;
}
// Use 32-bit integers if we won't overflow in the integral image
if ((image.depth() == CV_8U || image.depth() == CV_8S) &&

Loading…
Cancel
Save