From 00094a879280f89acaad8f1d48bd8a873957e32b Mon Sep 17 00:00:00 2001 From: Nisarg Thakkar Date: Thu, 16 Apr 2015 00:22:08 +0530 Subject: [PATCH] Fix for Bug4243. Made changes relating to non OpenCL devices --- modules/imgproc/src/morph.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 78c0e4f0aa..f2d971bea3 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -1823,19 +1823,13 @@ void cv::morphologyEx( InputArray _src, OutputArray _dst, int op, InputArray _kernel, Point anchor, int iterations, int borderType, const Scalar& borderValue ) { -#ifdef HAVE_OPENCL - Size ksize = _kernel.size(); - Mat tempKernel; - if (ksize.height==0 || ksize.width==0) - { - tempKernel = getStructuringElement(MORPH_RECT, Size(3,3), Point(1,1)); - ksize = tempKernel.size(); - } - else + Mat kernel = _kernel.getMat(); + if (kernel.empty()) { - tempKernel = _kernel.getMat(); + kernel = getStructuringElement(MORPH_RECT, Size(3,3), Point(1,1)); } - InputArray kernel = InputArray(tempKernel); +#ifdef HAVE_OPENCL + Size ksize = kernel.size(); anchor = normalizeAnchor(anchor, ksize); CV_OCL_RUN(_dst.isUMat() && _src.dims() <= 2 && _src.channels() <= 4 &&