From 3ed829af7186482c0c24ceead7e82b116588206e Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Thu, 2 Jun 2011 22:58:52 +0000 Subject: [PATCH] - make sure we deal with a grayscale image --- modules/features2d/src/orb.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/features2d/src/orb.cpp b/modules/features2d/src/orb.cpp index c0f2858..7f35118 100644 --- a/modules/features2d/src/orb.cpp +++ b/modules/features2d/src/orb.cpp @@ -545,12 +545,16 @@ void ORB::operator()(const cv::Mat &image, const cv::Mat &mask, std::vector & keypoints_in_out, +void ORB::operator()(const cv::Mat &image_in, const cv::Mat &mask, std::vector & keypoints_in_out, cv::Mat & descriptors, bool do_keypoints, bool do_descriptors) { if ((!do_keypoints) && (!do_descriptors)) return; + cv::Mat image; + if (image_in.type() != CV_8UC1) + cvtColor(image_in, image, CV_BGR2GRAY); + if (do_descriptors) descriptors.release(); @@ -716,9 +720,6 @@ void ORB::computeKeyPoints(const std::vector& image_pyramid, const std: void ORB::computeOrientation(const cv::Mat& image, const cv::Mat& integral_image, unsigned int scale, std::vector& keypoints) const { - // If using the integral image, some offsets will be pre-computed for speed - std::vector horizontal_offsets(8 * half_patch_size_), vertical_offsets(8 * half_patch_size_); - // Process each keypoint for (std::vector::iterator keypoint = keypoints.begin(), keypoint_end = keypoints.end(); keypoint != keypoint_end; ++keypoint) -- 2.7.4