Image Processing Reference
In-Depth Information
5
Neighborhood Processing
In the previous chapter we saw that a pixel value in the output was set according
to a pixel value in the input at the same position and a point processing operation.
This principle has many useful applications (as we saw), but it cannot be applied to
investigate the relationship between neighboring pixels . For example, if we look at
the pixel values in the small area in Fig. 5.1 , we can see that a significant change in
intensity values occurs in the lower left corner. This could indicate the boundary of
an object and by finding the boundary pixels we have found the object.
In this and the next chapter we present a number of methods where the neighbor
pixels play a role when determining the output value of a pixel. Overall these meth-
ods are denoted neighborhood processing and the principle is illustrated in Fig. 5.2 .
The value of a pixel in the output is determined by the value of the pixel at the same
position in the input and the neighbors together with a neighborhood processing
operation. We use the same notation as in the previous chapter, i.e., f(x,y) is the
input image and g(x,y) is the output image. 1
5.1
The Median Filter
If we look at Fig. 5.3 we can see that it has been infected with some kind of noise
(the black and white dots). Let us set out to remove this noise. First of all we zoom
in on the image and look closer at particular pixel values. What we can see is that
the noise is isolated pixels having a value of either 0 (black) or 255 (white), such
noise is denoted salt-and-pepper noise .By isolated we mean that they have a value
very different from their neighbors. We need somehow to identify such pixels and
replace them by a value which is more similar to the neighbors.
One solution is to replace the noise pixel by the mean value of the neighbors. Say
we use the eight nearest neighbors for the noise pixel at position ( 1 , 1 ) in the image
patch in Fig. 5.3 . The mean value is then