medianFilter {EBImage} | R Documentation

## 2D constant time median filtering

### Description

Process an image using Perreault's modern constant-time median filtering algorithm [1, 2].

### Usage

    medianFilter(x, size, cacheSize=512)

### Arguments

`x` | an `Image` object or an array.
`size` | integer, median filter radius.
`cacheSize` | integer, the L2 cache size of the system CPU in kB.

### Details

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.

### Value

An `Image` object or an array, containing the filtered version of `x`.

### Author(s)

Joseph Barry, joseph.barry@embl.de, 2012

Andrzej Oleś, andrzej.oles@embl.de, 2016

### References

[1] S. Perreault and P. Hebert, "Median Filtering in Constant Time", IEEE Trans Image Process 16(9), 2389-2394, 2007

[2] http://nomis80.org/ctmf.html

### See Also

`gblur`

### Examples

      x = readImage(system.file("images", "nuclei.tif", package="EBImage"))
      display(x, title='Nuclei')
      y = medianFilter(x, 5)
      display(y, title='Filtered nuclei')

[Package EBImage version 4.22.1 Index]