From 58be2546ca6ba3e00ab7f008069f70ff984ba3bd Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 28 Oct 2013 16:46:41 +0400 Subject: [PATCH] fixed OpenCL morph operations for case when kernel does not have zero element --- modules/ocl/src/filtering.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ocl/src/filtering.cpp b/modules/ocl/src/filtering.cpp index 954d1d5aa0..4a04e2de83 100644 --- a/modules/ocl/src/filtering.cpp +++ b/modules/ocl/src/filtering.cpp @@ -416,8 +416,8 @@ void morphOp(int op, const oclMat &src, oclMat &dst, const Mat &_kernel, Point a else if (iterations > 1 && countNonZero(_kernel) == _kernel.rows * _kernel.cols) { anchor = Point(anchor.x * iterations, anchor.y * iterations); - kernel = getStructuringElement(MORPH_RECT, Size(ksize.width + iterations * (ksize.width - 1), - ksize.height + iterations * (ksize.height - 1)), anchor); + kernel = getStructuringElement(MORPH_RECT, Size(ksize.width + (iterations - 1) * (ksize.width - 1), + ksize.height + (iterations - 1) * (ksize.height - 1)), anchor); iterations = 1; } else