Linear Filtering in Image Processing

Linear filtering is a fundamental operation in image processing and computer vision. It is used to modify or enhance an image by applying a filter (kernel) over a local neighborhood of pixels. The result is a new image in which each pixel value is a weighted sum of its neighbors, with weights defined by the filter kernel.

1. Definition of Linear Filtering

A linear filter transforms an input image f(i, j) into an output image g(i, j) by computing:

g(i, j) = Σ Σ f(i + k, j + l) × h(k, l)

where:

  • h(k, l) is the filter kernel (weights)
  • The operation is performed over a small window (neighborhood)

This process is also called convolution when the filter is applied with flipped indices:

g(i, j) = Σ Σ f(i − k, j − l) × h(k, l)

In compact form: g = f * h

2. Properties of Linear Filters

  • Shift Invariant: Same operation is applied throughout the image.
  • Linear: Follows the principle of superposition.
  • Efficient: Can be computed using convolution or correlation.

3. Common Types of Linear Filters with Examples

a) Box Filter (Moving Average Filter)

– All pixel weights are equal (e.g., 3×3 matrix of 1s). – Averages pixel values in a K×K window. – Used for basic blurring.

1/9 ×
[1 1 1
 1 1 1
 1 1 1]

Example: Used to smooth noisy images.

b) Bilinear (Tent or Bartlett) Filter

– A separable filter that gives more weight to central pixels. – The 2D kernel is the outer product of two linear vectors.

1/16 ×
[1 2 1
 2 4 2
 1 2 1]

Example: Gentle smoothing with better edge preservation than box filter.

c) Gaussian Filter

– Smooths the image using a kernel derived from the Gaussian function. – Provides isotropic, smooth blurring, and is widely used in preprocessing.

1/256 ×
[1 4 6 4 1
 4 16 24 16 4
 6 24 36 24 6
 4 16 24 16 4
 1 4 6 4 1]

Example: Used for denoising, blurring before edge detection.

d) Sobel Filter (Edge Detection)

– Used to detect vertical or horizontal edges. – Combines smoothing and differentiation.

Horizontal Sobel:
[ -1  0  1
  -2  0  2
  -1  0  1 ]

Example: Enhances vertical edges in an image.

e) Laplacian Filter (Second Derivative)

– Captures areas where intensity changes rapidly. – Used to find edges and corners.

[ 1 -2  1
 -2  4 -2
  1 -2  1 ]

Example: Corner detection, edge enhancement.

4. Separable Filters

Many 2D filters can be expressed as the product of two 1D filters: one horizontal and one vertical. This reduces the computational cost from O(K²) to O(2K).

Example: Gaussian and Tent filters are separable.

5. Applications of Linear Filters

  • Blurring and denoising
  • Edge detection (Sobel, Laplacian)
  • Image sharpening (Unsharp masking)
  • Feature detection (corners, interest points)

Leave a Reply

Your email address will not be published. Required fields are marked *