# What Are Filters: Matrix Filters, Spatial Filters, Moving Window or Convolution Filters (Especially for GATE-Geospatial 2022)

Get unlimited access to the best preparation resource for CTET/Paper-1 : get questions, notes, tests, video lectures and more- for all subjects of CTET/Paper-1.

Examrace Books on Mapping, GIS, and Remote Sensing prepares you throughly for a wide range of practical applications.

A filter is a mathematical process that consists in isolating interest components by reinforcing or softening the grey level special contrasts that are integrated into an image. In other words, the aim is to transform the original digital levels of each pixel so that they either look like or differentiate from their neighbours.

### Matrix Filter

As shown in the figure, a filter consists in a matrix that moves through the whole original image and that considers the values of the neighbour pixels to assign the DN of the pixel in the filtered image.

• Depending on the type of matrix used to filter the original image, the effects would be different in the filtered image.
• The operation called filtering is an operation that changes the value of a pixel according to the “grey” values of its surrounding pixels (it is a so-called “focal operation” ) . This might be called a spatial stretching operation, unlike a contrast stretch that is operating on the single pixel.
• When filtering, we are actually analysing the variance of the pixel values in space, that is, we are dealing with the spatial frequency of an image. Any image can be seen as made of two basic components of information: a high-frequency component (high pass) and a low-frequency component (low pass) , their sum makes up the original image. High frequencies describe sudden⧵big changes in pixel values along a short distance (linear features: geologic faults, rivers, roads, pipelines, etc or the borders of area features: buildings, etc) . Low frequencies describe gradual⧵small changes in pixel values in space (such as water bodies, agricultural fields, natural vegetation, etc) .

## Spatial Filters

• The spatial operation of filtering receives its name because it lets only those frequencies in the image that we want to remain. High-pass filters will emphasize spatial change (borders) , while low-pass filters will generate an image that will appear smooth or blurred relative to the original (such a filter can be used to eliminate noises) . The basic principles of a filter
• Although there are many kinds of filters that can be applied to an image, the basic principles of their operation are similar:
• The window size of the filter is to be defined; usually having an odd number of columns and rows (the number of the rows equals that of the columns) .
• A weight is assigned to each pixel in the window. The pixel values in the window, with the window, are termed “kernel” .
• The filtered image is obtained by moving the window we have defined, and multiplying each weight in that window, with the value of the corresponding pixel (concerning its location in the window) in the original image. The sum-product (the sum of the multiplications) is the new value of the pixel in the new image.

## Moving Window or Convolution

Moving the window over the whole image, this operation is performed on a pixel by pixel basis. Mathematically, this operation is known as “convolution” . In order that pixels along the perimeter of an image can be a centre for the window, the perimeter pixels are duplicated (temporarily) during the filter operation, as described in the following figure: