int gx= get_global_id(0);
int gy= get_global_id(1);
-
+
int dx = gx - x - 1;
int dy = gy - y - 1;
int r = clamp(dy+dr, 0, rows-1);
int index1 = mad24(r, srcStep, srcOffset + c*scnbytes);
-
+
r = clamp(dy+dr+9, 0, rows-1);
int index9 = mad24(r, srcStep, srcOffset + c*scnbytes);
int dr=id/20;
int dc=id%20;
-
+
int c=clamp(dx+dc, 0, cols-1);
int r = clamp(dy+dr, 0, rows-1);
int index1 = mad24(r, srcStep, srcOffset + c*scnbytes);
-
+
r = clamp(dy+dr+10, 0, rows-1);
int index10 = mad24(r, srcStep, srcOffset + c*scnbytes);
-
+
__global DATA_TYPE * src = (__global DATA_TYPE *)(srcptr + index1);
data[dr][dc] = src[0];
src = (__global DATA_TYPE *)(srcptr + index10);
op(p7, p11); op(p11, p13); op(p11, p12);
int dst_index = mad24( gy, dstStep, dstOffset + gx * scnbytes);
-
+
if( gy < rows && gx < cols)
{
__global DATA_TYPE* dst = (__global DATA_TYPE *)(dstptr + dst_index);
{
int type = _src.type();
int depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
-
+
if (!((depth == CV_8U || depth == CV_16U || depth == CV_16S || depth == CV_32F) && (cn == 1 || cn == 4)))
return false;
-
+
const char * kernelName;
-
+
if (m==3)
kernelName = "medianFilter3";
else if (m==5)
ocl::Kernel k(kernelName,ocl::imgproc::medianFilter_oclsrc,format("-D type=%s",ocl::typeToStr(type)));
if (k.empty())
return false;
-
+
_dst.create(_src.size(),type);
UMat src = _src.getUMat(), dst = _dst.getUMat();
CV_Assert( ksize % 2 == 1 );
if( ksize <= 1 )
- {
+ {
Mat src0 = _src0.getMat();
_dst.create( src0.size(), src0.type() );
Mat dst = _dst.getMat();
src0.copyTo(dst);
return;
}
-
+
bool use_opencl = ocl::useOpenCL() && _dst.isUMat();
- // if ( use_opencl && ocl_medianFilter(_src0,_dst, ksize))
- if (use_opencl)
- { CV_Assert (ocl_medianFilter(_src0,_dst,ksize));
- return;}
-
+ if ( use_opencl && ocl_medianFilter(_src0,_dst, ksize))
+ return;
+
Mat src0 = _src0.getMat();
_dst.create( src0.size(), src0.type() );
Mat dst = _dst.getMat();