From bffb5f8b5826ae3dae2ba6015669b0dd3b54706d Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Sat, 13 Nov 2010 20:23:20 +0000 Subject: [PATCH] fixed initialization of the border interpolation table in the filter engine (ticket #161) --- modules/imgproc/src/filter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/imgproc/src/filter.cpp b/modules/imgproc/src/filter.cpp index 19c51b2ba..fc8f1737e 100644 --- a/modules/imgproc/src/filter.cpp +++ b/modules/imgproc/src/filter.cpp @@ -270,19 +270,21 @@ int FilterEngine::start(Size _wholeSize, Rect _roi, int _maxBufRows) } else { + int xofs1 = std::min(roi.x, anchor.x) - roi.x; + int btab_esz = borderElemSize, wholeWidth = wholeSize.width; int* btab = (int*)&borderTab[0]; for( i = 0; i < dx1; i++ ) { - int p0 = borderInterpolate(i-dx1, wholeWidth, rowBorderType)*btab_esz; + int p0 = (borderInterpolate(i-dx1, wholeWidth, rowBorderType) + xofs1)*btab_esz; for( j = 0; j < btab_esz; j++ ) btab[i*btab_esz + j] = p0 + j; } for( i = 0; i < dx2; i++ ) { - int p0 = borderInterpolate(wholeWidth + i, wholeWidth, rowBorderType)*btab_esz; + int p0 = (borderInterpolate(wholeWidth + i, wholeWidth, rowBorderType) + xofs1)*btab_esz; for( j = 0; j < btab_esz; j++ ) btab[(i + dx1)*btab_esz + j] = p0 + j; }