The Mathematica Journal
Departments
Feature Articles
Columns
New Products
New Publications
Classifieds
Calendar
News Bulletins
Mailbox
Letters
Write Us
About the Journal
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues
Home
Download this Issue

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 [Graphics:../Images/index_gr_104.gif] moving-average filter.

[Graphics:../Images/index_gr_105.gif]
[Graphics:../Images/index_gr_106.gif]

The averaging property of the moving-average filter may be verified by substituting for [Graphics:../Images/index_gr_107.gif] in Equation (2.8) the values of the filter. It is easily seen that the output [Graphics:../Images/index_gr_108.gif] is equal to an average of the sample values in the nine-element neighborhood of sample [Graphics:../Images/index_gr_109.gif].

[Graphics:../Images/index_gr_110.gif]

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.

[Graphics:../Images/index_gr_113.gif]

This sets some useful display options for ListDensityPlot.

[Graphics:../Images/index_gr_114.gif]

This shows the example image.

[Graphics:../Images/index_gr_115.gif]

[Graphics:../Images/index_gr_116.gif]

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.

[Graphics:../Images/index_gr_117.gif]

[Graphics:../Images/index_gr_118.gif]

A standard technique to improve image quality is to enhance the visibility of edges by using a technique called unsharp masking [2]. 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

[Graphics:../Images/index_gr_119.gif]

where [Graphics:../Images/index_gr_120.gif] is the original image and [Graphics:../Images/index_gr_121.gif] is the lowpass filtered image, a and b are positive constants with [Graphics:../Images/index_gr_122.gif], and [Graphics:../Images/index_gr_123.gif] is the processed image. Here are some typical impulse responses of unsharp masking filters.

[Graphics:../Images/index_gr_124.gif]

The parameter [Graphics:../Images/index_gr_127.gif] is a real constant in the range [Graphics:../Images/index_gr_128.gif]. Here we define a [Graphics:../Images/index_gr_129.gif] unsharp filter.

[Graphics:../Images/index_gr_130.gif]

Here we demonstrate unsharp masking. First we blur the original books image.

[Graphics:../Images/index_gr_131.gif]

Here we show the result. Note the somewhat improved quality of the unsharp masked image compared to the blurred copy.

[Graphics:../Images/index_gr_132.gif]

[Graphics:../Images/index_gr_133.gif]

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 [Graphics:../Images/index_gr_134.gif] is defined as

[Graphics:../Images/index_gr_135.gif]

The orientation of an edge is sometimes of interest. The gradient orientation is given by

[Graphics:../Images/index_gr_136.gif]

Local maxima of the gradient magnitude identify edges in [Graphics:../Images/index_gr_137.gif]. In the case of a digital image, the derivatives [Graphics:../Images/index_gr_138.gif] and [Graphics:../Images/index_gr_139.gif] are easily obtained by convolving the image with two FIR differentiators. Here is one frequently used filter pair known as the Sobel edge detector.

[Graphics:../Images/index_gr_140.gif]
[Graphics:../Images/index_gr_141.gif]

This returns the two-directional derivatives of the example image using the Sobel filters.

[Graphics:../Images/index_gr_142.gif]

Here we compute the gradient magnitude and edge direction.

[Graphics:../Images/index_gr_143.gif]

This displays the edge magnitude and the orientation.

[Graphics:../Images/index_gr_144.gif]

[Graphics:../Images/index_gr_145.gif]


Converted by Mathematica     

[Article Index] [Prev Page][Next Page]