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

- 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:
-
list arbitrary-rank numerical array tseries temporal data such as TimeSeries, TemporalData, … image arbitrary Image or Image3D object audio an 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.


Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Harmonic mean filtering of a list:

https://wolfram.com/xid/0cptyoea8obhuy-s47pnq

Filter a TimeSeries:

https://wolfram.com/xid/0cptyoea8obhuy-ctzx4

https://wolfram.com/xid/0cptyoea8obhuy-77v7p5


https://wolfram.com/xid/0cptyoea8obhuy-18tdm0

Harmonic mean filtering applied to a color image:

https://wolfram.com/xid/0cptyoea8obhuy-hz36oe

Scope (12)Survey of the scope of standard use cases
Data (8)
Apply a moving harmonic mean filter to a vector:

https://wolfram.com/xid/0cptyoea8obhuy-wfj9re

Harmonic mean filtering of a 2D array:

https://wolfram.com/xid/0cptyoea8obhuy-cxywqj

Filter a TimeSeries:

https://wolfram.com/xid/0cptyoea8obhuy-cx9jy

https://wolfram.com/xid/0cptyoea8obhuy-4amfq


https://wolfram.com/xid/0cptyoea8obhuy-cv7xrc


https://wolfram.com/xid/0cptyoea8obhuy-jopin9

Filter an Audio signal:

https://wolfram.com/xid/0cptyoea8obhuy-dflgzt

https://wolfram.com/xid/0cptyoea8obhuy-em7h2s


https://wolfram.com/xid/0cptyoea8obhuy-ndwk9g

Filtering a 2D grayscale image:

https://wolfram.com/xid/0cptyoea8obhuy-dc0gtv

Harmonic mean filtering of a 3D volume:

https://wolfram.com/xid/0cptyoea8obhuy-6jwd04


https://wolfram.com/xid/0cptyoea8obhuy-lm9bsz

Parameters (4)
Specify one radius to be used in all directions:

https://wolfram.com/xid/0cptyoea8obhuy-tlzgi7

Increasing the radius will result in smoother images:

https://wolfram.com/xid/0cptyoea8obhuy-ibus74

Harmonic mean filtering just in the first direction:

https://wolfram.com/xid/0cptyoea8obhuy-gdx3zh


https://wolfram.com/xid/0cptyoea8obhuy-hzoyls

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

https://wolfram.com/xid/0cptyoea8obhuy-37xttb

Filtering of the horizontal planes only:

https://wolfram.com/xid/0cptyoea8obhuy-5u7xo

Applications (3)Sample problems that can be solved with this function

https://wolfram.com/xid/0cptyoea8obhuy-e400fa

Use harmonic mean filtering if your data has outliers:

https://wolfram.com/xid/0cptyoea8obhuy-ioz7qz


https://wolfram.com/xid/0cptyoea8obhuy-icwggl

Reduce effect of outliers in an image:

https://wolfram.com/xid/0cptyoea8obhuy-e5xtyf

Properties & Relations (4)Properties of the function, and connections to other functions
The harmonic mean is the reciprocal of the mean of reciprocals of the given data:

https://wolfram.com/xid/0cptyoea8obhuy-cqzltl

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

https://wolfram.com/xid/0cptyoea8obhuy-i40d86

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

https://wolfram.com/xid/0cptyoea8obhuy-fns4nv

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

https://wolfram.com/xid/0cptyoea8obhuy-dhww66

Wolfram Research (2008), HarmonicMeanFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/HarmonicMeanFilter.html (updated 2016).
Text
Wolfram Research (2008), HarmonicMeanFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/HarmonicMeanFilter.html (updated 2016).
Wolfram Research (2008), HarmonicMeanFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/HarmonicMeanFilter.html (updated 2016).
CMS
Wolfram Language. 2008. "HarmonicMeanFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/HarmonicMeanFilter.html.
Wolfram Language. 2008. "HarmonicMeanFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/HarmonicMeanFilter.html.
APA
Wolfram Language. (2008). HarmonicMeanFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HarmonicMeanFilter.html
Wolfram Language. (2008). HarmonicMeanFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/HarmonicMeanFilter.html
BibTeX
@misc{reference.wolfram_2025_harmonicmeanfilter, author="Wolfram Research", title="{HarmonicMeanFilter}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/HarmonicMeanFilter.html}", note=[Accessed: 30-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_harmonicmeanfilter, organization={Wolfram Research}, title={HarmonicMeanFilter}, year={2016}, url={https://reference.wolfram.com/language/ref/HarmonicMeanFilter.html}, note=[Accessed: 30-April-2025
]}