MedianFilter

MedianFilter[image,r]

filters image by replacing every value by the median in its range-r neighborhood.

MedianFilter[data,{r1,r2,}]

uses ri for filtering the ^(th)dimension in data.

Details

  • MedianFilter is a nonlinear filter commonly used to locally smooth data and diminish noise, where the amount of smoothing is dependent on the value of r. Median filtering is well known to remove salt-and-pepper noise from images.
  • The function applied to each range-r neighborhood is Median.
  • The data can be any of the following:
  • listarbitrary-rank numerical array
    tseriestemporal data such as TimeSeries, TemporalData,
    imagearbitrary Image or Image3D object
    audioan Audio object
  • For multichannel images, MedianFilter replaces each pixel by a pixel in its neighborhood that has the median total intensity.
  • MedianFilter[data,{r1,r2,}] computes the median value in blocks centered on each sample.
  • MedianFilter assumes the index coordinate system for lists and images.
  • At the data boundaries, MedianFilter uses smaller neighborhoods.

Examples

open allclose all

Basic Examples  (3)

Median filter of a list:

Filter a TimeSeries:

Median filter of an image:

Scope  (11)

Data  (6)

Median filtering of a numeric vector:

Median filtering of a 2D array:

Median filtering of a list of Quantity objects:

Filter an Audio signal:

Filtering a 2D grayscale image:

Median filter of a 3D image:

Parameters  (5)

Specify one radius to be used in all directions:

Increasing the radius will result in smoother images:

Median filtering just in the first direction:

Median filtering just in the second direction:

Median filtering of a 3D image in the vertical direction only:

Mean filtering of a 3D image in the horizontal planes only:

Applications  (6)

Remove salt-and-pepper noise from image:

Perform an edge-preserving smoothing:

Remove noise from an ultrasound image:

Remove dithering from an image:

Use a median filter to remove smaller stars from an astronomical image:

Use MedianFilter to smooth a time series and identify the trend:

Properties & Relations  (2)

Compare MedianFilter with the moving median:

Corresponding call to obtain a moving median:

Compare MedianFilter to MeanFilter:

Neat Examples  (1)

Find the root median of an image:

Wolfram Research (2008), MedianFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/MedianFilter.html (updated 2016).

Text

Wolfram Research (2008), MedianFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/MedianFilter.html (updated 2016).

CMS

Wolfram Language. 2008. "MedianFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/MedianFilter.html.

APA

Wolfram Language. (2008). MedianFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MedianFilter.html

BibTeX

@misc{reference.wolfram_2024_medianfilter, author="Wolfram Research", title="{MedianFilter}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/MedianFilter.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_medianfilter, organization={Wolfram Research}, title={MedianFilter}, year={2016}, url={https://reference.wolfram.com/language/ref/MedianFilter.html}, note=[Accessed: 22-November-2024 ]}