3. Linear Filtering
Many useful image processing operations may be implemented by filtering with a selected FIR filter [2, 3, 4]. This is known as linear filtering and finds application in edge detection, image sharpening, noise reduction, and image matching. According to Equations (2.2), (2.3), (2.7), and (2.8) the output image is obtained by a convolution operation. The choice of filter depends on the desired outcome. Here we demonstrate a number of standard FIR filters commonly used in operations such as blurring, unsharp masking, and edge detection.
We first consider so-called smoothing filters that return the local average of the samples of a signal. Such an operation tends to reduce the local variability of sample values and thus decreases signal noise and smoothes the signal. However, averaging also smears image edges resulting in a blurred picture. The simplest such filter returns a matrix with constant coefficients equal to the inverse of the filter's dimensions. This FIR filter is commonly known as a moving-average filter or box filter.
Here is a moving-average filter.
The averaging property of the moving-average filter may be verified by substituting for in Equation (2.8) the values of the filter. It is easily seen that the output is equal to an average of the sample values in the nine-element neighborhood of sample .
Averaging operations are useful in removing noise from a signal, however, they also tend to blur the signal, due to smoothing of sharp transitions in image intensity (i.e., edges).
This loads an example image.
This sets some useful display options for
This shows the example image.
Here we demonstrate image smoothing with two moving-average filters of different dimensions. Note that the degree of smoothing is directly related to the dimensions of the moving-average filter.
A standard technique to improve image quality is to enhance the visibility of edges by using a technique called unsharp masking . Unsharp masking introduces overshoots in the vicinity of an edge, effectively simulating a well-documented human visual phenomenon known as the Mach band effect. Mach bands are nonexistent overshoots that we tend to perceive in the vicinity of sharp brightness transitions in a picture. This linear operation may be implemented by convolving an image with an unsharp filter. In unsharp masking, the original image is blurred and a fraction of the unsharp image is subtracted from the original. This can be expressed as
where is the original image and is the lowpass filtered image, a and b are positive constants with , and is the processed image. Here are some typical impulse responses of unsharp masking filters.
The parameter is a real constant in the range . Here we define a unsharp filter.
Here we demonstrate unsharp masking. First we blur the original
Here we show the result. Note the somewhat improved quality of the unsharp masked image compared to the blurred copy.
Edge detection is a common image processing task [2, 3, 4]. It is well known that edges are important to mammalian vision. In typical images, edges characterize object boundaries and therefore are useful for segmentation, registration, and identification of objects in a scene. The most commonly used edge detection methods are implemented as linear filtering operations with FIR filters that approximate directional derivatives. Specifically, the so-called gradient magnitude of some continuous function is defined as
The orientation of an edge is sometimes of interest. The gradient orientation is given by
Local maxima of the gradient magnitude identify edges in . In the case of a digital image, the derivatives and are easily obtained by convolving the image with two FIR differentiators. Here is one frequently used filter pair known as the Sobel edge detector.
This returns the two-directional derivatives of the example image using the Sobel filters.
Here we compute the gradient magnitude and edge direction.
This displays the edge magnitude and the orientation.
Converted by Mathematica