Source: Rafael C.Gonzalez, Richard E.Woods "Digital image processing" p.231-235

## 5.3.1 Mean Filters

In this section we discuss briefly the noise-reduction spatial filters introduced in Section 3.6 and develop several other filters whose performance is in many cases superior to the filters discussed in that section.

### Arithmetic mean filter

This is the simplest of the mean filters. Let Sxv represent the set of coordinates in a rectangular subimage window of size m X n, centered at point (x, y).The arithmetic mean filtering process computes the average value of the corrupted image g(x, y) in the area defined by Sxy.The value of the restored image at any point (x, y) is simply the arithmetic mean computed using the pixels in the region defined by S. In other words.

This operation can be implemented using a convolution mask in which ail coefficients have value 1/mn. As discussed in Section 3.6.1, a mean filter simply smoothes local variations in an image. Noise is reduced as a result of blurring.

### Geometric mean filter

An image restored using a geometric mean filter is given by the expression

Here, each restored pixel is given by the product of the pixels in the subimage window, raised to the power 1/mn. As shown in Example 52, a geometric mean filter achieves smoothing comparable to the arithmetic mean filter, but it tends to lose less image detail in the process.

### Harmonic mean filter

The harmonic mean filtering operation is given by the expression

The harmonic mean filter works well for salt noise, but fails for pepper noise. It does well also with other types of noise tike Gaussian noise.

### Contraharmonic mean filter

The contraharmonic mean filtering operation yields a restored image based on the expression

where Q is called the order of the filter. This filter is well suited for reducing or virtually eliminating the effects of salt-and-pepper noise. For positive values of Q, the filter eliminates pepper noise. For negative values of Q it eliminates salt noise. It cannot do both simultaneously. Note that the contraharmonic filter reduces to the arithmetic mean filter if Q = 0, and to the harmonic mean filter if Q = - 1

## 5.3.2 Order-Statistics Filters

Order-statistics filters were introduced in Section 3.6.2. We now expand the dis¬cussion in that section and introduce some additional order-statistics filters. As noted in Section 3.6.2, order-statistics filters are spatial filters whose response is based on ordering (ranking) the pixels contained in the image area encom¬passed by the filter. The response of the filter at any point is determined by the ranking result

### Median filter

The best-known order-statistics filter is the median filter, which, as its name implies, replaces the value of a pixel by the median of the gray levels in the neighborhood of that pixel:

The original value of the pixel is included in the computation of the median. Median filters are quite popular because, for certain types of random noise, they provide excellent noise-reduction capabilities, with considerably less blurring than linear smoothing filters of similar size. Median filters are particularly effective in the presence of both bipolar and unipolar impulse noise. In fact, as Ex¬ample 5.3 shows, the median filter yields excellent results for images corrupted by this type of noise. Computation of the median and implementation of this filter are discussed in detail in Section 3.6.2.

### Max and min filters

Although the median filter is by far the order-statistics filter most used in image processing.it is by no means the only one. The median represents the 50th percentile of a ranked set of numbers, but the reader will recall from basic statis¬tics that ranking lends itself to many other possibilities. For example, using the 100th perccntile results in the so-called max filter given by:

This filter is useful for finding the brightest points in an image. Also, because pep¬per noise has very low values, it is reduced by this filter as a result of the max selection process in the subimage area S. The 0th percentile filter is the Min filter.

Sourse: Rafael C.Gonzalez, Richard E.Woods "Digital image processing" Second Edition, p.231-235