Fixed medianFilter

This commit is contained in:
Elena Gvozdeva 2013-12-17 11:04:54 +04:00
parent 8fe4e98b8a
commit 125d67130b
3 changed files with 5 additions and 5 deletions

View File

@ -62,7 +62,7 @@ __kernel void medianFilter3(__global const uchar* srcptr, int srcStep, int srcOf
r = clamp(dy+dr+9, 0, rows-1); r = clamp(dy+dr+9, 0, rows-1);
int index9 = mad24(r, srcStep, srcOffset + c*scnbytes); int index9 = mad24(r, srcStep, srcOffset + c*scnbytes);
__global DATA_TYPE * src = (__global DATA_TYPE *)(srcptr + index1); __global DATA_TYPE * src = (__global DATA_TYPE *)(srcptr + index1);
data[dr][dc] = src[0]; data[dr][dc] = src[0];
@ -83,7 +83,7 @@ __kernel void medianFilter3(__global const uchar* srcptr, int srcStep, int srcOf
op(p4, p2); op(p6, p4); op(p4, p2); op(p4, p2); op(p6, p4); op(p4, p2);
int dst_index = mad24( gy, dstStep, dstOffset + gx * scnbytes); int dst_index = mad24( gy, dstStep, dstOffset + gx * scnbytes);
if( gy < rows && gx < cols) if( gy < rows && gx < cols)
{ {
__global DATA_TYPE* dst = (__global DATA_TYPE *)(dstptr + dst_index); __global DATA_TYPE* dst = (__global DATA_TYPE *)(dstptr + dst_index);

View File

@ -1668,7 +1668,7 @@ namespace cv
int type = _src.type(); int type = _src.type();
int depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(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))) if (!((depth == CV_8U || depth == CV_16U || depth == CV_16S || depth == CV_32F) && (cn != 3 || cn <= 4)))
return false; return false;
const char * kernelName; const char * kernelName;
@ -1696,7 +1696,7 @@ namespace cv
void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize ) void cv::medianBlur( InputArray _src0, OutputArray _dst, int ksize )
{ {
CV_Assert( ksize % 2 == 1 ); CV_Assert( (ksize % 2 == 1) && (_src0.dims() <= 2 ));
if( ksize <= 1 ) if( ksize <= 1 )
{ {

View File

@ -102,7 +102,7 @@ OCL_TEST_P(MedianFilter, Mat)
OCL_INSTANTIATE_TEST_CASE_P(ImageProc, MedianFilter, Combine( OCL_INSTANTIATE_TEST_CASE_P(ImageProc, MedianFilter, Combine(
Values(CV_8U, CV_16U, CV_16S, CV_32F), Values(CV_8U, CV_16U, CV_16S, CV_32F),
Values(1, 4), Values(1, 2, 4),
Values(3, 5), Values(3, 5),
Bool()) Bool())
); );