Docsity

Spatial Filtering in Image Processing: CS474/674 Lecture Notes, Schemes and Mind Maps of Mathematics

Partial preview of the text

Download Spatial Filtering in Image Processing: CS474/674 Lecture Notes and more Schemes and Mind Maps Mathematics in PDF only on Docsity!

Spatial Filtering

CS474/674 - Prof. Bebis Sections 3.4, 3.5, 3.6, 3.7, 3.

Spatial Filtering Methods

output image Area/Mask processing methods.

Spatial Filtering – Neighborhood

Typically, it has a square shape K x K center (we call it a “window”). We prefer an odd size neighborhood (e.g., 3x3 or 5x5) so we can easily define its center.

Spatial filtering - Operation

output image

  • (^) Operation depends on the task, for example:
  • (^) The result is stored at the corresponding center location in the output image. z’ 5 = 5z 1 -3z 2 +z 3 -z 4 -2z 5 -3z 6 +z 8 -z 9 -9z 7

Linear Operators

  • (^) Most common linear operators:
    • (^) Correlation
    • (^) Convolution
  • (^) The output is always a linear combination of the inputs!

Correlation (linear operator)

output image

  • (^) The output of correlation is a weighted sum of the input pixels. The weights are defined by a K x K mask (has the same size as the window): z 5   w z 1 1 (^)  w z 2 (^) 2  w z 3 3 (^)  w z 4 (^) 4  w z 5 (^) 5  w z 6 (^) 6  w z 7 (^) 7  w z 8 (^) 8  w z 9 9 W 1 W 2 W 3 W 4 W 5 W 6 W 7 W 8 W 9

Handling Locations Close to Boundaries

  • (^) Pad with zeroes.
  • (^) Alternatively, skip the first/last few rows/columns. 0 0 0 ………………………. 0 0 0 ……………………….

Correlation (cont’d)

Useful in applications where we need to measure the similarity between an image and a pattern (e.g., template matching). Simple template matching does not work in most practical cases.

Example

Correlation: Convolution:

Filter Categories

  • (^) We will focus on two types of filters:
    • (^) Smoothing (also called “low-pass”) filters
      • (^) Useful for removing details
    • (^) Sharpening (also called “high-pass”) filters
      • (^) Useful for enhancing details

Smoothing filters – Example

input image smoothed image

Sharpening Filters (high-pass)

  • (^) Useful for enhancing fine details but be aware that it enhances noise too! - (^) The elements of the mask contain both positive and negative weights. - (^) Mask elements sum to 0.

Common Smoothing Filters

  • (^) Averaging (linear)
  • (^) Gaussian (linear)
  • (^) Median filtering (non-linear)

Smoothing Filters: Averaging

  • (^) The mask weights are all equal to 1