Here, f(x, y) is the input image and v(x, y) is the output image. T is some specified operation on the input f conducted over a neighbourhood of the point with coordinates (x, y). During neighbourhood processing, the operation T is applied to each neighbourhood as it is moved from pixel to pixel in the image, in order to produce an output image. The neighbourhood typically has a rectangular shape, is much smaller than the image, and is centred on the pixel (x, y). Figure 7 shows the basic implementation of neighbourhood processing.
Figure 7: A spatial domain representation of a 3x3 neighbourhood centred on a point (x, y) in an image f.
Median filtering forms part of the spatial domain operations performed on an image, specifically the spatial filtering category. A median filter utilises neighbourhood operations to replace the central value of an M-by-N neighbourhood of pixels with the median value of all the pixels in the neighbourhood.
If the neighbourhood does not have an exact centre, the algorithm enforces its bias toward the upper left corner. Due to the median value being less sensitive to extreme values than the mean value, this block is effective in removing salt and pepper noise in an image without significant reduction in image sharpness.
While being good at removing salt and pepper noise from an image, median filters also cause a fair amount of blurring of edges. For this reason, these types of filters are often used in computer vision applications where it is not of critical importance to preserve edges, as is the case for size estimation of spherical-shaped pellets, but rather to smooth out a region of intensities in an image. (x, y) Image f x y
19
Another method often used to remove noise is to convolve the original image with a mask that represents a low-pass filter. This is often termed as a smoothing operation. An example of such a mask is a Gaussian mask, which comprises of elements that is determined by a Gaussian function. By applying this convolution, the value of each pixel is brought into closer harmony with the values of its neighbours. This is achieved by setting each pixel to a weighted average value, of the pixel itself and its nearby neighbours. The Gaussian filter represents one possible set of weights.
As with median filters, smoothing filters such as the Gaussian mask also tend to blur an image. This is due to the fact that pixel intensity values that are significantly higher or lower than the surrounding neighbourhood would "smear" across the area.
Contrast enhancement
The objective of the enhancement step is typically to clarify objects of interest within the image. This could refer to highlighting particles in the foreground, so as to eliminate dim and blurred particles in the background and avoid errors in size estimation. Furthermore, Gonzales & Woods (2008) describe enhancement as any process that manipulates an image so that the result of this manipulation renders the output image more useful than the original image for a specified application. This definition automatically describes enhancement techniques as being problem specific.
Contrast stretching
This technique forms part of the piecewise-linear transformation functions conducted on digital images to increase overall image contrast. The technique creates an increased contrast in the image by increasing the spectrum of intensity levels in an image to such an extent that it spans the whole intensity range of the recording medium or display device (Gonzalez & Woods 2008). Low contrast in images can be the result of poor illumination, incorrect aperture settings during image acquisition, or a lack of dynamic range in the imaging sensor.
Figure 8 shows a typical transformation function used for contrast stretching. In this function,
r and s denote the pixel intensities of the input and the output images respectively. The
positions of the two points (r1, s1) and (r2, s2) control the shape of the transformation function.
The special case of the r1 = r2, s1 = 0 and s2 = L – 1 produces a thresholding function. This
kind of function produces a binary image, and will be discussed later in this section. By
changing the positions of (r1, s1) and (r2, s2) various degrees of contrast can be achieved in
the output image due to the varying spread of the intensity levels in the output image. In order to achieve a function that is single valued and increases monotonically, general
practise requires r1 ≤ r2 and s1 ≤ s2. Enforcing this norm ensures that the order of intensity
20
Figure 8: Typical form of a transformation function used for contrast stretching.
Maximum contrast stretching of the entire range of input intensities can be achieve by setting
(r1, s1) = (rmin, 0) and (r2, s2) = (rmax, L - 1). In these parameters, rmin and rmax represent the
minimum and maximum intensity levels in the image. A transformation function having these parameters stretches the input intensity levels linearly from their original range to the full range of [0, L – 1].
Histogram processing
Histogram Processing refers to a group of techniques that aim to increase contrast in an image by performing operations using the histogram of an image. Gonzales & Woods (2008) describe the histogram of a digital image with intensities in the range [0, L – 1], as the
discrete function h(rk) = nk. In this equation, rk is the kth intensity value and nk is the number
of pixels in the image having an intensity equal to rk. Gonzales & Woods (2008) state that it
is also common practise to normalise the histogram of an image. This is done by dividing each of the components of the histogram by the total number of pixels in the image. This total is equal to the product M x N, where, as mentioned earlier, M and N are the number of rows and columns present in the image, respectively. From this procedure, a normalised histogram can be represented by Equation 5:
( ) ( )