# difference between mean filter and order statistic filter

I am working on my paper about comparing between mean filter and ordering statistics filter, The mean filter is contraharmonic mean filter and the ordering statistic filter is alphatrimmed mean filter. So, I compare contraharmonic mean filter and alphatrimmed mean filter

and i've read a slide presentation that explain mean filter is good for removing some kind of gaussian noise (uniform noise) and order statistics filter is good for removing some kind of exponential noise and salt & pepper noise (rayleigh noise).

Can anybody here show me the book source of that statement? is it in gonzales book? Thank you so much, your answers will help me a lot and sorry for my poor english :(

• Votes and best answer validation are required Jul 28 '19 at 12:02

The main difference of this filters is how it perform the operations.

## Mean Filter

### Brief Description

Mean filtering is a spatial filter, and it's a simple, intuitive and easy to implement method of smoothing images, i.e. reducing the amount of intensity variation between one pixel and the next.

### How It Works

The idea of mean filtering is simply to replace each pixel value in an image with the mean (`average') value of its neighbors, including itself. Mean filtering is usually thought of as a convolution filter and it's based around a kernel, which represents the shape and size of the neighborhood to be sampled when calculating the mean. Often a 3×3 square kernel is used like this $$K = \left[ {\begin{array}{cc} \frac{1}{9} & \frac{1}{9} & \frac{1}{9}\\ \frac{1}{9} & \frac{1}{9} & \frac{1}{9}\\ \frac{1}{9} & \frac{1}{9} & \frac{1}{9}\\ \end{array} } \right]$$

Note: Check this link for more details in mean filtering.

## Order Statistics Filter

### Brief Description

This type of filter is based on estimators and is based on "order", the sense of order is about some quatities like $\operatorname{min}$ (first order statistic), $\operatorname{max}$ (largest order statistic) and etc...

### How It Works

Given $N$ observations $X_{1}, X_{2}, X_{3}, \dots X_{N}$ of a random variable $X$, the order statistics are obtained by sorting the $\{X_{i}\}$ in ascending order. This produces $\{X_{(i)}\}$ satisfying:

$$X_{(1)} \leq X_{(2)} \leq X_{(3)} \dots \leq X_{(N)}$$

where $\{X_{i}\}$ are the order statistics of the N observations. So, an Order Statistic Filter (OSF) is a estimator $F(X_{1}, X_{2}, X_{3}, \dots X_{N})$.

Some common filters which fit the order statistic filter framework are:

• The linear average, which has coefficients: $$\alpha_{i} = \frac{1}{N}$$

• The median filter, which has coefficients: $$\alpha_{i} = \left\{ \begin{array}{ll} 1 & i = (N+1)/2\\ 0 & \text{otherwise} \end{array} \right.$$

• The trimmed mean filter, which has coefficients: $$\alpha_{i} = \left\{ \begin{array}{ll} 1/M & (N - M + 1)/2 \leq i \leq (N + M + 1)/2 \\ 0 & \text{otherwise} \end{array} \right.$$

Please check the references for more details in the Todd Veldhuizen web page.

I don't know where it was first mentioned, but what you are looking is essentially covered in Robust Statistics. Robust Statistics covers methods which reduce the effect of outliers. If you consider the mean, if you have one extreme value in your data (either due to error or even if it's correct) the mean will be severely affected. The median, on the other hand, will not affected as much.

Given, that - the distributions like Exponential and Rayleigh are heavy tailed distributions which means you are more likely to have extreme values which leads to the poorer performance of traditional estimates like mean and covariance. Use of Trimmed-Means, Winsorized Means, and Medians reduce the effect of these heavy tailed distributions on the estimates.

You'll probably find the books on Robust Statistics go into much more detail and analysis than you are looking for. Here are some references

• Introduction to Robust Estimation and Hypothesis Testing by Rand Wilcox
• Robust Statistics Theory and Methods by Maronna, Martin, Yohai
• Robust Statistics by Hampel

It is generally quite useful to start from the filters we know.

$\alpha$-trimmed filters exist with two types: the outer (average in the inner interval) and the inner-trimmed (average of the outer intervals). The latter is sometimes called $\alpha$-trimmed complementary mean. The $0.5$-trimmed inner filter is the median filter. The $0$-trimmed inner filter is the standard mean. The $0$-trimmed outer filter is the midpoint or midrange filter. You can learn a great deal on them with Alpha-trimmed means and their relationship to median filters, Bednar et al., 1984.

The efficiency can be probed in many ways, for instance with maximum likelihood estimators. The mean is a quite efficient central tendency estimator for mesokurtic noises, like the Gaussian. The median can be better (more robust to outliers) for leptokurtic (heavy-tailed) distributions, like the Laplacian. The midrange, seldom used, is optimal for uniform distributions. It is not robust at all, but the $\alpha$-trimmed midrange addresses robustness. The median is alright for impulse noises, such as salt, pepper, or salt-and-pepper. You can read Salt-and-Pepper Noise Removal by Median-type Noise Detectors and Detail-preserving Regularization, Raymond H. Chan, Chung-Wa Ho, and Mila Nikolova.

The contraharmonic mean (discovered by the Greek mathematician Eudoxos in the 4th century BCE) is, strictly speaking, of the form: $\frac{a^2_i}{a_i}$ (using a tensor-like notation). Its generalized version is the generalized contraharmonic mean: $\frac{a^{p+1}_i}{a^p_i}$ (as written by @Dipan Mehta).

I like the paper Nonlinear mean filters in image processing, I. Pitas, A. N. Venetsanopoulos, 1984, or their book Nonlinear digital filters: principles and applications. They explain that while the median has been extensively used for impulse noise removal, it deteriorates rapidly by increasing the probability of spike occurrence.

On the other side, contraharmonic filters tend to distribute positive (resp. negative) spikes to their surrounding pixels (depending on the sign of $p$), and do not handle nicely enough two-sided impulse noise removal

You can also read Nonlinear Image Processing, Sanjit Kumar Mitra and Giovanni L. Sicuranza, 2001.

OK - in simple terms mean filter is the low pass filter applied through averaging of a fixed window convoluted through the image. You can learn from here about the basic filter theory. This filter creates smoothing and blurring of the image.

Another filter is a median filter where from the given window the median value is selected. From the same site as above here is the explanation of the median filter. This filter is best and simplest when it comes to removing outliers and hence noise of salt paper types.

Note that simple mean filter is linear where as median filter is a non-linear one.

Alpha-trimmed mean filter is a class of filters, by its nature is hybrid of the mean and median filters. In a pure median filter you arrange all values in a pertaining window in a sorted order and discard all values except the center one. In Alpha-trimmed mean filter you discard the extreme ends but then do averaging. See here for more details.

The Contra-harmonic mean filter is defined here as equation :

$$\hat{f}(x,y)=\frac{\sum_{(s,t)\in S_{xy}}^{}g(s,t)^{Q+1}}{\sum_{(s,t)\in S_{xy}}^{}g(s,t)^{Q}}$$

Here $g(s,t)$ is essentially the pixel value of image $g$ at location $(s,t)$. We can notice that when $Q=0$ this is an ordinary mean filter. When $Q=-1$, it is same as harmonic mean filter which is inverse of the mean filter. So for $Q<0$ the filter works very well for salt noise and $Q>1$ works better for pepper noise.

See this document to see all definitions: http://masters.donntu.org/2007/kita/gett/library/eng.htm