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:

Introduced in 2008
 (7.0)
 |
Updated in 2015
 (10.2)
2016
 (11.0)