From 2b1e13f8f45bc7175c61a07580daa61ff192b3ee Mon Sep 17 00:00:00 2001 From: Gurpinder Singh Sandhu Date: Thu, 4 Apr 2013 22:52:07 +0530 Subject: [PATCH 1/2] changed surfFeaturesFinder::find() to allow CV_8UC1 type images http://code.opencv.org/issues/2926 --- modules/stitching/src/matchers.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/stitching/src/matchers.cpp b/modules/stitching/src/matchers.cpp index 2231d13681..d05afff24f 100644 --- a/modules/stitching/src/matchers.cpp +++ b/modules/stitching/src/matchers.cpp @@ -348,7 +348,15 @@ SurfFeaturesFinder::SurfFeaturesFinder(double hess_thresh, int num_octaves, int void SurfFeaturesFinder::find(const Mat &image, ImageFeatures &features) { Mat gray_image; - CV_Assert(image.type() == CV_8UC3); + CV_Assert((image.type() == CV_8UC3) || (image.type() == CV_8UC1)); + if(image.type() == CV_8UC3) + { + cvtColor(image, gray_image, CV_BGR2GRAY); + } + else + { + gray_image = image; + } cvtColor(image, gray_image, CV_BGR2GRAY); if (surf == 0) { From 69127e4105b3798d7540f40d34e768d946038e7c Mon Sep 17 00:00:00 2001 From: Gurpinder Singh Sandhu Date: Thu, 4 Apr 2013 22:54:27 +0530 Subject: [PATCH 2/2] some typo --- modules/stitching/src/matchers.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/stitching/src/matchers.cpp b/modules/stitching/src/matchers.cpp index d05afff24f..9bab58c52f 100644 --- a/modules/stitching/src/matchers.cpp +++ b/modules/stitching/src/matchers.cpp @@ -357,7 +357,6 @@ void SurfFeaturesFinder::find(const Mat &image, ImageFeatures &features) { gray_image = image; } - cvtColor(image, gray_image, CV_BGR2GRAY); if (surf == 0) { detector_->detect(gray_image, features.keypoints);