Is it possible to apply a median blur on an image with a custom kernel?
At the moment I see medianBlur(src, dst, ksize)
only allows ksize which will result in a square kernel. For example ksize=3 will give a kernel that is
[1, 1, 1; 1, 1, 1; 1, 1, 1]
so the median is taken from 9 pixels.
I’d like a kernel that is also of size 3, but with [0,1,0;1,1,1;0,1,0]
so the median is taken from 5 pixels.
generally, non-rectangular kernels ruin the time complexity of the median filter.
I’m unaware of this functionality in OpenCV.
scipy.ndimage.median_filter
sounds useful.
Thanks. I’ll look into that function. Setting the footprint
parameter seems to be exactly what I’m looking for.