From 18ef25ec309beea035deb3fd9f4010b49902ef64 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Wed, 9 Apr 2014 16:04:21 +0400 Subject: [PATCH] cv::calcHist --- modules/imgproc/src/histogram.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/imgproc/src/histogram.cpp b/modules/imgproc/src/histogram.cpp index 04dc7e2..cdccde0 100644 --- a/modules/imgproc/src/histogram.cpp +++ b/modules/imgproc/src/histogram.cpp @@ -1190,6 +1190,26 @@ void cv::calcHist( const Mat* images, int nimages, const int* channels, Mat hist = _hist.getMat(), ihist = hist; ihist.flags = (ihist.flags & ~CV_MAT_TYPE_MASK)|CV_32S; +#ifdef HAVE_IPP + if (nimages == 1 && images[0].type() == CV_8UC1 && dims == 1 && channels && + channels[0] == 0 && mask.empty() && images[0].dims <= 2 && + !accumulate && uniform) + { + hist.setTo(Scalar::all(0)); + AutoBuffer levels(histSize[0] + 1); + IppStatus status = + ippiHistogramEven_8u_C1R( + (const Ipp8u *)images[0].data, (int)images[0].step, ippiSize(images[0].size()), + (Ipp32s *)ihist.data, (Ipp32s *)levels, histSize[0] + 1, (Ipp32s)ranges[0][0], (Ipp32s)ranges[0][1]); + + if (status >= 0) + { + ihist.convertTo(hist, CV_32F); + return; + } + } +#endif + if( !accumulate || histdata != hist.data ) hist = Scalar(0.); else @@ -1477,7 +1497,7 @@ void cv::calcHist( InputArrayOfArrays images, const std::vector& channels, CV_OCL_RUN(images.total() == 1 && channels.size() == 1 && images.channels(0) == 1 && channels[0] == 0 && images.isUMatVector() && mask.empty() && !accumulate && histSize.size() == 1 && histSize[0] == BINS && ranges.size() == 2 && - ranges[0] == 0 && ranges[1] == 256, + ranges[0] == 0 && ranges[1] == BINS, ocl_calcHist(images, hist)) int i, dims = (int)histSize.size(), rsz = (int)ranges.size(), csz = (int)channels.size(); -- 2.7.4