### SPATIAL FILTERING

Spatial filtering is an image processing procedure that accentuates contrasts locally in the spatial domain. Thus, if there are boundaries between features on either side of which reflectances (or emissions) are quite different (notable as sharp or abrupt changes in DN value), these boundaries can be emphasized by any one of several filters. The resulting images are often quite distinctive in appearance. Linear features, in particular, such as geologic faults can be made to stand out.

Although less commonly performed, spatial filtering techniques explore the distribution of pixels of varying brightness over an image and, especially detect and sharpen boundary discontinuities. These changes in scene illumination, which are typically gradual rather than abrupt, produce a relation that we express quantitatively as “spatial frequencies”. The spatial frequency is defined as the number of cycles of change in image DN values per unit distance (e.g., 10 cycles/mm) along a particular direction in the image. An image with only one spatial frequency consists of equally spaced stripes (raster lines). For instance, a blank TV screen with the set turned on, has horizontal stripes. This situation corresponds to zero frequency in the horizontal direction and a high spatial frequency in the vertical (see Fig 1).

 Fig 1:  A TV screen with a set of horizontal lines exemplifies a high spatial frequency in the vertical direction and zero frequency in the horizontal direction.

Images of practical interest generally consist of several dominant spatial frequencies. Fine detail in an image means a larger number of changes per unit distance as compared to coarse image features. The mathematical technique for separating an image into its various spatial frequency components is called Fourier Analysis. After an image is separated into its components (done as a “Fourier Transform”), it is possible to emphasize certain groups (or “bands”) of frequencies relative to others and recombine the spatial frequencies into an enhanced image. Algorithms for this purpose are called “spatial filters” because they suppress (de-emphasize) certain frequencies and pass (emphasize) others. Spatial filters that pass high frequencies and, hence, emphasize fine detail and edges, are called highpass filters. Filters that suppress high frequencies and therefore ‘smooth’ an image are called lowpass filters.  Lowpass filters are also used to eliminate the ‘salt and pepper’ effect or noise in an image. The type of filter used, high- or low-pass, depends on the spatial frequency distribution of DN values and on what the user wishes to emphasize.

By way of an example to demonstrate this, we will apply the two types of filters to ETM Band 4 image of the area around Aligarh town. The first that we display is the original data without any contrast enhancement (Fig 2).  Next, we apply a lowpass (mean) filter, which tends to generalize the image (Fig 3).  Application of the highpass filter emphasizes fine details in the image and brings out a sharp contrast between adjacent features (Fig 4).

 Fig 2:  Landsat ETM Band 4 image representing the area around Aligarh Town.

 Fig 3:  Landsat ETM Band 4 image representing the area around Aligarh Town, with the lowpass filter applied.  Application of this filter tends to generalize the image. Fig 4:  Landsat ETM Band 4 image representing the area around Aligarh Town, with the highpass filter applied.  Application of this filter tends to emphasize fine detail in the image.

Convolution filtering is a common mathematical method of applying spatial filters. In this, each pixel value is replaced by the average over a square area centered on that pixel. Square sizes are typically 3 x 3, 5 x 5, or 7 x 7 pixels but other values are acceptable (Fig 5).

 Fig 5:  Convolution filtering involves replacing the pixel value with an average of values over a square area.

As in lowpass filtering, the convolution filtering tends to reduce deviations from local averages and thus smoothes the image. The difference between the input image and the convoluted image is the lowpass-filtered effect similar to that shown in Fig 3. Generally, spatially filtered images must be contrast stretched to use the full range of image display. Nevertheless, filtered images tend to appear flat.

An edge enhancement filter highlights abrupt discontinuities, such as rock joints and faults, field boundaries, and street patterns.  Fig 6a is an ASTER image in band combination 732 as RGB.  Fig 6b shows an edge enhanced image of the same area.  Drainage and other lineaments have been rendered sharp in the edge enhanced image.

 Fig 6a:  ASTER image of an area in north Pithoragarh in band combination 742 as RGB. Fig 6b:  The same area as in Fig 6a, after conversion to 256 gray level and applying the edge enhancement filter.

Another spatial filter is the Sobel Edge Enhancement algorithm which finds an overabundance of discontinuities.  It can be used to emphasize sharp boundaries.  Fig 7 is the same image as in Fig 6a to which the Sobel filter has been applied after converting the image to 256 gray levels.

 Fig 7:  Sobel edge enhancement filter applied to the image in Fig 6a after converting it to 256 gray levels.

The edge detection filter also highlights edges.  Fig 8 represents the same image as in Fig 2 to which the edge detection filter has been applied.

 Fig 8:  Edge detection filter applied to the image in Fig 2 after converting it to 256 gray levels.

 Notes & Handouts The Himalayas Kumaon Himalayas Askot Basemetals University

This website is hosted by

S. Farooq

Department of Geology

Aligarh Muslim University, Aligarh - 202 002 (India)

Phone: 91-571-2721150

email: farooq.amu@gmail.com