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


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


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


open allclose all

Basic Examples  (3)

Harmonic mean filtering of a list:

Filter a TimeSeries:

Harmonic mean filtering applied to a color image:

Scope  (12)

Data  (8)

Apply a moving harmonic mean filter to a vector:

Harmonic mean filtering of a 2D array:

Filter a TimeSeries:

Filter a quantity array:

Filter an Audio signal:

Filtering a 2D grayscale image:

Harmonic mean filtering of a 3D volume:

Filter a symbolic array:

Parameters  (4)

Specify one radius to be used in all directions:

Increasing the radius will result in smoother images:

Harmonic mean filtering just in the first direction:

Second direction:

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

Filtering of the horizontal planes only:

Applications  (3)

Blur a grayscale image:

Use harmonic mean filtering if your data has outliers:

Reduce effect of outliers in an image:

Properties & Relations  (4)

The harmonic mean is the reciprocal of the mean of reciprocals of the given data:

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

Harmonic mean filtering is the same as ArrayFilter with function HarmonicMean:

Harmonic mean filtering is the same as ImageFilter with function HarmonicMean:

Introduced in 2008
Updated in 2015