2D constant time median filtering
Process an image using Perreault's modern constant-time median filtering algorithm [1, 2].
medianFilter(x, size, cacheSize=512)
x |
an |
size |
integer, median filter radius. |
cacheSize |
integer, the L2 cache size of the system CPU in kB. |
Median filtering is useful as a smoothing technique, e.g. in the removal of speckling noise.
For a filter of radius size
, the median kernel is a 2*size+1
times 2*size+1
square.
The input image x
should contain pixel values in the range from 0 to 1,
inclusive; values lower than 0 or higher than 1 are clipped before applying
the filter. Internal processing is performed using 16-bit precision. The
behavior at image boundaries is such as the source image has been padded with
pixels whose values equal the nearest border pixel value.
If the image contains multiple channels or frames, the filter is applied to each one of them separately.
An Image
object or an array, containing the filtered version
of x
.
Joseph Barry, joseph.barry@embl.de, 2012
Andrzej Oleś, andrzej.oles@embl.de, 2016
[1] S. Perreault and P. Hebert, "Median Filtering in Constant Time", IEEE Trans Image Process 16(9), 2389-2394, 2007
x = readImage(system.file("images", "nuclei.tif", package="EBImage")) display(x, title='Nuclei') y = medianFilter(x, 5) display(y, title='Filtered nuclei')
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.