Median filter support for large kernel

asked 2016-03-12 11:50:16 -0600

gdarmon gravatar image

in the documentation medianBlur(InputArray src, OutputArray dst, int ksize)

src – input 1-, 3-, or 4-channel image; when ksize is 3 or 5, the image depth should be CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U.

Large aperture size are not supported for more than 8 bit. Can someone please explain why? I'm trying to convert matlab code which uses medfilt2 function with a 7x7 kernel, however my image is 16 bits per pixel.

I know that openCV integrated this algorithm into median filter

Is there a plan to add 16 bit support for large kernels? I would like to try to use Intel Cilk plus to optimize the code for larger bits and larger kernels. has anyone come across this issue before? optimizing for 7x7 kernel for 16 bit depth images?

edit retag flag offensive close merge delete


There are a lot of places where CV_8U is supported but CV_16U is not. I had looked at the medianBlur to make a larger CV_16U version a while back, but it was messy. It looks like it has been cleaned up quite a bit. You shouldn't have too much trouble in making a CV_16U version.

The only thing to be careful of is why it chooses _O1 vs _Om. The if statement is un-commented so you'll need to understand why it's the way it is before you change things.

Tetragramm gravatar imageTetragramm ( 2016-03-12 16:55:06 -0600 )edit