Understanding Spatial and Frequency Filters

Sep 7, 2024

Lecture 4: Digital Image Processing

Overview

  • Continuing discussion on spatial filtering.
  • Brief introduction to Fourier Transform (to be covered in detail later).

Spatial Filtering

Smoothing (Low-Pass Filters)

  • Used to reduce sharp transitions in image density and random noise.
  • Types of smoothing filters:
    • Linear filters (e.g., Box filters).
    • Non-Linear filters (e.g., Median filters).

Sharpening (High-Pass Filters)

  • Highlights intensity transitions in images.
  • Enhances edges and discontinuities.

Definitions & Operations

  • Neighborhood: Area defined around a pixel for filtering.
  • Kernel: Array of weights used in spatial filtering.
    • Example: 3x3 kernel.
    • Calculation involves element-wise multiplication and summation.

Types of Spatial Filters

  • Linear Spatial Filters:

    • Produce a sum of products based on the kernel weights.
    • Example Equation:
      • G(x, y) = Σ W(m, n) * I(x+m, y+n)
  • Non-Linear Spatial Filters:

    • Different operation than linear (e.g., median filtering).

Convolution vs. Correlation

  • Linear Spatial Filtering: Convolution is commonly used.
  • Properties of Convolution:
    • Commutative: f * g = g * f.
    • Associative: f * (g * h) = (f * g) * h.
    • Distributive: f * (g + h) = f * g + f * h.

Smoothing Filters

  • Box Filters: Simple averaging; uniform weights.
  • Gaussian Filters: Circularly symmetric; better for blurring; utilizes standard deviation (σ).
    • Gaussian function is defined as:
      • K(x, y) = (1/(2πσ²)) * e^(-(x²+y²)/2σ²)

Padding Techniques

  • Zero Padding: Adds zeros around the image.
  • Mirror or Symmetric Padding: Mirrors edge values.
  • Replicate Padding: Replicates values adjacent to borders.

Non-Linear Filters

Median Filter

  • Orders pixel values in the neighborhood and replaces center pixel with the median.
  • Effective for reducing salt and pepper noise.

High-Pass Filters

Sharpening Techniques

  • Laplacian Operator: Highlights edges by using second derivatives.
    • Kernel example for Laplacian:
      • [-1, -1, -1]
      • [-1, 8, -1]
      • [-1, -1, -1]
  • Gradient Magnitude: Uses first derivatives for edge detection.
  • Unsharp Masking: Subtracts a blurred version from the original image to enhance details.

Fourier Transform Overview

  • Relates spatial and frequency domains:
    • Convolution in spatial domain = Multiplication in frequency domain.
  • Categories of Filters:
    • Low-Pass, High-Pass, Bandpass, Band Reject.
  • Fourier Transform computational advantages:
    • Speeds up convolution operations significantly (especially for large kernels).

Future Topics

  • Detailed coverage of Fourier Series and Transform in next lectures.
  • Convolution in frequency domain and sampling discussed in detail.