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.
Figure 3.23 illustrates the performance of out-range pixel smoothing. The image in Figure 3.23 is the result after processing the image in Figure 3.21(b) using out-range pixel smoothing with a threshold value of 50 and a 3 x 3-point window.