diff --git a/modules/imgproc/src/clahe.cpp b/modules/imgproc/src/clahe.cpp index 45658ef561..677b6a0738 100644 --- a/modules/imgproc/src/clahe.cpp +++ b/modules/imgproc/src/clahe.cpp @@ -162,7 +162,9 @@ namespace // calc histogram - int tileHist[histSize] = {0, }; + cv::AutoBuffer _tileHist(histSize); + int* tileHist = _tileHist.data(); + std::fill(tileHist, tileHist + histSize, 0); int height = tileROI.height; const size_t sstep = src_.step / sizeof(T); diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 1575ffb915..1665e0a40c 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -2167,7 +2167,8 @@ public: virtual void operator() (const Range& range) const CV_OVERRIDE { const int BLOCK_SZ = 64; - short XY[BLOCK_SZ*BLOCK_SZ*2], A[BLOCK_SZ*BLOCK_SZ]; + AutoBuffer __XY(BLOCK_SZ * BLOCK_SZ * 2), __A(BLOCK_SZ * BLOCK_SZ); + short *XY = __XY.data(), *A = __A.data(); const int AB_BITS = MAX(10, (int)INTER_BITS); const int AB_SCALE = 1 << AB_BITS; int round_delta = interpolation == INTER_NEAREST ? AB_SCALE/2 : AB_SCALE/INTER_TAB_SIZE/2, x, y, x1, y1; diff --git a/modules/imgproc/src/pyramids.cpp b/modules/imgproc/src/pyramids.cpp index ab6c8fdb6f..4f7732925c 100644 --- a/modules/imgproc/src/pyramids.cpp +++ b/modules/imgproc/src/pyramids.cpp @@ -750,9 +750,9 @@ pyrDown_( const Mat& _src, Mat& _dst, int borderType ) Size ssize = _src.size(), dsize = _dst.size(); int cn = _src.channels(); - int tabL[CV_CN_MAX*(PD_SZ+2)], tabR[CV_CN_MAX*(PD_SZ+2)]; - AutoBuffer _tabM(dsize.width*cn); - int* tabM = _tabM.data(); + AutoBuffer _tabM(dsize.width * cn), _tabL(cn * (PD_SZ + 2)), + _tabR(cn * (PD_SZ + 2)); + int *tabM = _tabM.data(), *tabL = _tabL.data(), *tabR = _tabR.data(); CV_Assert( ssize.width > 0 && ssize.height > 0 && std::abs(dsize.width*2 - ssize.width) <= 2 &&