From 32d56c6b4304e138903492d34436b67347d2ef42 Mon Sep 17 00:00:00 2001 From: Nils Plath Date: Thu, 5 Mar 2015 23:55:07 +0100 Subject: [PATCH] Fixed: wrong conversion of float-based Mat input inside the AKAZE. --- modules/features2d/src/akaze.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/features2d/src/akaze.cpp b/modules/features2d/src/akaze.cpp index 4037d1c5c3..1b6e30e459 100644 --- a/modules/features2d/src/akaze.cpp +++ b/modules/features2d/src/akaze.cpp @@ -172,7 +172,14 @@ namespace cv cvtColor(image, img, COLOR_BGR2GRAY); Mat img1_32; - img.convertTo(img1_32, CV_32F, 1.0 / 255.0, 0); + if ( img.depth() == CV_32F ) + img1_32 = img; + else if ( img.depth() == CV_8U ) + img.convertTo(img1_32, CV_32F, 1.0 / 255.0, 0); + else if ( img.depth() == CV_16U ) + img.convertTo(img1_32, CV_32F, 1.0 / 65535.0, 0); + + CV_Assert( ! img1_32.empty() ); AKAZEOptions options; options.descriptor = descriptor;