diff --git a/modules/imgproc/src/filter.cpp b/modules/imgproc/src/filter.cpp index fc8f1737e6..107a1a45c6 100644 --- a/modules/imgproc/src/filter.cpp +++ b/modules/imgproc/src/filter.cpp @@ -219,7 +219,7 @@ int FilterEngine::start(Size _wholeSize, Rect _roi, int _maxBufRows) srcRow.resize(esz*(maxWidth + ksize.width - 1)); if( columnBorderType == BORDER_CONSTANT ) { - constBorderRow.resize(getElemSize(bufType)*(maxWidth+VEC_ALIGN)); + constBorderRow.resize(getElemSize(bufType)*(maxWidth + ksize.width - 1 + VEC_ALIGN)); uchar *dst = alignPtr(&constBorderRow[0], VEC_ALIGN), *tdst; int n = (int)constBorderValue.size(), N; if( isSeparable() )