MeanFilter

MeanFilter[data,r]

filters data by replacing every value by the mean value in its range-r neighborhood.

MeanFilter[data,{r1,r2,}]

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

Details

  • MeanFilter is used to locally smooth data and diminish noise, where the amount of smoothing is dependent on the value of r.
  • The function applied to each range-r neighborhood is Mean.
  • 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 and audio signals, MeanFilter operates separately on each channel.
  • MeanFilter[data,{r1,r2,}] computes the mean value in blocks centered on each sample.
  • MeanFilter assumes the index coordinate system for lists and images.
  • At the data boundaries, MeanFilter uses smaller neighborhoods.

Examples

open allclose all

Basic Examples  (3)

Mean filtering of a list:

Filter a TimeSeries:

Filter an image:

Scope  (12)

Data  (7)

Mean filtering of a numeric vector:

Mean filtering of a 2D array:

Mean filtering of a symbolic list:

Mean filtering of a list of Quantity objects:

Filter an Audio signal:

Filtering a 2D grayscale image:

Mean filtering of a 3D volume:

Parameters  (5)

Specify one radius to be used in all directions:

Increasing the radius will result in smoother images:

Mean filtering just in the first direction:

Second direction:

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

Filtering of the horizontal planes only:

Use a quantity parameter with a TimeSeries input:

Applications  (3)

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

Denoise an ultrasound image with mean filtering:

Unsharp masking using mean filtering:

Properties & Relations  (5)

Compare filtering results using geometric, harmonic and standard mean filters:

For positive data, HarmonicMeanFilter[data,r]GeometricMeanFilter[data,r]MeanFilter[data,r]:

MeanFilter is equivalent to ListConvolve with a moving-average filter of length , if samples are removed from the border:

However, ListConvolve is substantially faster:

MeanFilter is a frequency-selective filter with a lowpass characteristic:

Use MedianFilter to avoid excessive edge blurring:

Interactive Examples  (1)

See the results of increasing filter radius on an image:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2023_meanfilter, organization={Wolfram Research}, title={MeanFilter}, year={2016}, url={https://reference.wolfram.com/language/ref/MeanFilter.html}, note=[Accessed: 18-March-2024 ]}