From 2ebf4e084a1d8e591247e13f5f298b74564227c7 Mon Sep 17 00:00:00 2001 From: LaurentBerger Date: Thu, 25 Jan 2018 12:23:31 +0100 Subject: [PATCH] solve issue #10687 --- modules/imgproc/src/histogram.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index b5c577528b..038bc5589f 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -2449,17 +2449,18 @@ void cv::calcBackProject( InputArrayOfArrays images, const std::vector& cha double scale ) { CV_INSTRUMENT_REGION() - + if (hist.dims() <= 2) + { #ifdef HAVE_OPENCL - Size histSize = hist.size(); - bool _1D = histSize.height == 1 || histSize.width == 1; - size_t histdims = _1D ? 1 : hist.dims(); + Size histSize = hist.size(); + bool _1D = histSize.height == 1 || histSize.width == 1; + size_t histdims = _1D ? 1 : hist.dims(); #endif - CV_OCL_RUN(dst.isUMat() && hist.type() == CV_32FC1 && - histdims <= 2 && ranges.size() == histdims * 2 && histdims == channels.size(), - ocl_calcBackProject(images, channels, hist, dst, ranges, (float)scale, histdims)) - + CV_OCL_RUN(dst.isUMat() && hist.type() == CV_32FC1 && + histdims <= 2 && ranges.size() == histdims * 2 && histdims == channels.size(), + ocl_calcBackProject(images, channels, hist, dst, ranges, (float)scale, histdims)) + } Mat H0 = hist.getMat(), H; int hcn = H0.channels();