Skip to content

Commit d71f31b

Browse files
committed
Merge pull request #1433 from Sahloul:freak_gray_img
2 parents 39af482 + be84634 commit d71f31b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/xfeatures2d/src/freak.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,13 @@ void FREAK_Impl::compute( InputArray _image, std::vector<KeyPoint>& keypoints, O
333333
((FREAK_Impl*)this)->buildPattern();
334334

335335
// Convert to gray if not already
336-
Mat grayImage = image;
337-
CV_Assert(grayImage.channels() == 1);
336+
Mat grayImage;
337+
if( image.channels() == 3 || image.channels() == 4 )
338+
cvtColor(image, grayImage, COLOR_BGR2GRAY);
339+
else {
340+
CV_Assert(image.channels() == 1);
341+
grayImage = image;
342+
}
338343

339344
// Use 32-bit integers if we won't overflow in the integral image
340345
if ((image.depth() == CV_8U || image.depth() == CV_8S) &&

0 commit comments

Comments
 (0)