Median Filtering (continued)
An important parameter in using a median filter is the size of the window. Figure (5.23) illustrates the result of median filtering the signal in Figure 5.22 (a) as a function of the window size. If the window size is less than 5, the two pixels with impulsive values will not be significantly affected. For a large window, they will be. Thus, the choice of the window size depends on the context. Because it is difficult to choose the optimum window size in advance, it may be useful to try several median filters of different window sizes and choose the best of the resulting images.
|
|
|
In the above, we discussed I-D median filtering. The task involved in performing a median filtering operation extends straightforwardly from the 1-D case to the 2-D case. However, not all properties of a 1-D median filter apply to a 2-D median filter. For example, median filtering a 1-D unit seep sequence u(n) preserves the step discontinuity and does not affect the signal u(n) at all. Suppose we filter a 2-D step sequence u(n1 ,n2) with a 2-D N X N-point median filter. Figure (5.24a) shows u(n1,n2 ) and Figure(5.24b) shows the result of filtering u(n1 ,n2 ) with a 2-D 5 x 5-point median filter. Suppose we filter a 2-D step sequence u(n 1 ,n2 ) with a 2-D N X N-point median filter. From Figure (b), the intensity discontinuities which can be viewed as 1-D steps (for large n1 and n2 =0 and large n2 at n1 =0) are seriously distorted. One method that tends to preserve 2-D step discontinuities will is to filter a 2-D signal along the horizontal direction with a 1-D median filter and then filter the result along the vertical direction with another 1-D median filter. This method is called separable median filtering, and is often used in 2-D median filtering applications. When a separable median filter is applied to u(n1 ,n2 ) the signal u(n1 ,n2 )is not affected.
|
|
A median filter is a nonlinear system, and therefore many theoretical results on linear systems are not applicable. For example, the result of separable median filtering depends on the order in which the 1-D horizontal and vertical median filters are applied. Despite this difficulty, some theoretical results have been developed on median filtering. One result states that repeated application of a 1-D median filter to a 1-D sequence eventually leads to a signal called a "root signal" which is invariant under further applications of the 1-D median filter.
Out-Range Pixel Smoothing
Like median filtering, out-range pixel smoothing is a nonlinear operation and is useful in reducing salt-and-pepper noise. In this method, a window slides along the image, and the average of the pixel values, excluding the pixel being processed, is obtained. If the difference between the average and the value of the pixel processed is above some threshold, then the current pixel value is replaced by the average. Otherwise, the value is not affected. Because it is difficult to determine the best parameter values in advance, it may be useful to process an image using several different threshold values and window sizes and select the best result.
|