From: Leonid Beynenson Date: Mon, 27 Feb 2012 17:46:53 +0000 (+0000) Subject: Changed the class OrbFeaturesFinder to make it work with CV_8UC4 and CV_8UC1 images. X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~5450 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9794f5977c05f2f4c3d1761606b5719dce75f9b2;p=platform%2Fupstream%2Fopencv.git Changed the class OrbFeaturesFinder to make it work with CV_8UC4 and CV_8UC1 images. --- diff --git a/modules/stitching/src/matchers.cpp b/modules/stitching/src/matchers.cpp index 0859d0e..9b6759b 100644 --- a/modules/stitching/src/matchers.cpp +++ b/modules/stitching/src/matchers.cpp @@ -351,8 +351,18 @@ OrbFeaturesFinder::OrbFeaturesFinder(Size _grid_size, size_t n_features, const O void OrbFeaturesFinder::find(const Mat &image, ImageFeatures &features) { Mat gray_image; - CV_Assert(image.type() == CV_8UC3); - cvtColor(image, gray_image, CV_BGR2GRAY); + + CV_Assert((image.type() == CV_8UC3) || (image.type() == CV_8UC4) || (image.type() == CV_8UC1)); + + if (image.type() == CV_8UC3) { + cvtColor(image, gray_image, CV_BGR2GRAY); + } else if (image.type() == CV_8UC4) { + cvtColor(image, gray_image, CV_BGRA2GRAY); + } else if (image.type() == CV_8UC1) { + gray_image=image; + } else { + CV_Assert(false); + } if (grid_size.area() == 1) (*orb)(gray_image, Mat(), features.keypoints, features.descriptors);