From 4dcf02d63155497586cab11efb6acf8f5171d0dd Mon Sep 17 00:00:00 2001 From: berak Date: Fri, 19 Jun 2015 11:34:56 +0200 Subject: [PATCH] fix for issue #195 avoid overflow in histogram access --- modules/ximgproc/src/structured_edge_detection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ximgproc/src/structured_edge_detection.cpp b/modules/ximgproc/src/structured_edge_detection.cpp index befc6dc2e..f61bda665 100644 --- a/modules/ximgproc/src/structured_edge_detection.cpp +++ b/modules/ximgproc/src/structured_edge_detection.cpp @@ -188,8 +188,8 @@ static void gradientHist(const cv::Mat &src, cv::Mat &magnitude, cv::Mat &histog magnitude.create( src.size(), cv::DataType::type ); phase.create( src.size(), cv::DataType::type ); - histogram.create( cv::Size( cvRound(src.size().width/float(pSize)), - cvRound(src.size().height/float(pSize)) ), + histogram.create( cv::Size( cvCeil(src.size().width/float(pSize)), + cvCeil(src.size().height/float(pSize)) ), CV_MAKETYPE(cv::DataType::type, nBins) ); histogram.setTo(0);