medianFilter: 2D constant time median filtering

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/medianFilter.R

Description

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

Usage

1
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<c5><9b>, 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

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

Example output

Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.
Only the first frame of the image stack is displayed.
To display all frames use 'all = TRUE'.

EBImage documentation built on Nov. 8, 2020, 5:41 p.m.