Spatial Filtering (Chapter 3) - PowerPoint PPT Presentation

About This Presentation
Title:

Spatial Filtering (Chapter 3)

Description:

Filters Filters Smoothing Filters: Averaging (Low-pass filtering) Smoothing Filters: Averaging (cont d) Smoothing Filters: Averaging (cont d) ... – PowerPoint PPT presentation

Number of Views:130
Avg rating:3.0/5.0
Slides: 46
Provided by: GeorgeB155
Learn more at: https://www.cse.unr.edu
Category:

less

Transcript and Presenter's Notes

Title: Spatial Filtering (Chapter 3)


1
Spatial Filtering (Chapter 3)
  • CS474/674 - Prof. Bebis

2
Spatial Filtering Methods (or Mask Processing
Methods)
3
Spatial Filtering
  • The word filtering has been borrowed from the
    frequency domain.
  • Filters are classified as
  • Low-pass (i.e., preserve low frequencies)
  • High-pass (i.e., preserve high frequencies)
  • Band-pass (i.e., preserve frequencies within a
    band)
  • Band-reject (i.e., reject frequencies within a
    band)

4
Spatial Filtering (contd)
  • Spatial filtering is defined by
  • (1) A neighborhood
  • (2) An operation that is performed on the pixels
    inside the neighborhood

5
Spatial Filtering - Neighborhood
  • Typically, the neighborhood is rectangular and
    its size
  • is much smaller than that of f(x,y)
  • - e.g., 3x3 or 5x5

6
Spatial filtering - Operation
Assume the origin of the mask is the center of
the mask.
for a 3 x 3 mask
for a K x K mask
7
Spatial Filtering - Example
  • A filtered image is generated as the center of
    the mask moves to every pixel in the input image.

8
Handling Pixels Close to Boundaries
pad with zeroes
0 0 0 .0
or
0 0 0 .0
9
Linear vs Non-LinearSpatial Filtering Methods
  • A filtering method is linear when the output is a
    weighted sum of the input pixels.
  • Methods that do not satisfy the above property
    are called non-linear.
  • e.g.,

10
Linear Spatial Filtering Methods
  • Two main linear spatial filtering methods
  • Correlation
  • Convolution

11
Correlation
g(i,j)
12
Correlation (contd)
Often used in applications where we need to
measure the similarity between images or parts of
images (e.g., pattern matching).
13
Convolution
  • Similar to correlation except that the mask is
    first flipped both horizontally and vertically.
  • Note if w(x,y) is symmetric, that is
    w(x,y)w(-x,-y), then convolution is equivalent
    to correlation!

14
Example
Correlation Convolution
15
How do we choose the elements of a mask?
  • Typically, by sampling certain functions.

16
Filters
  • Smoothing (i.e., low-pass filters)
  • Reduce noise and eliminate small details.
  • The elements of the mask must be positive.
  • Sum of mask elements is 1 (after normalization)

17
Filters (contd)
  • Sharpening (i.e., high-pass filters)
  • Highlight fine detail or enhance detail that has
    been blurred.
  • The elements of the mask contain both positive
    and negative weights.
  • Sum of the mask weights is 0 (after
    normalization)

18
Smoothing Filters Averaging(Low-pass filtering)
19
Smoothing Filters Averaging (contd)
  • Mask size determines the degree of smoothing and
    loss of detail.

3x3
5x5
7x7
original
15x15
25x25
20
Smoothing Filters Averaging (contd)
Example extract, largest, brightest objects
15 x 15 averaging
image thresholding
21
Smoothing filters Gaussian
  • The weights are samples of the Gaussian function

s 1.4
mask size is a function of s
22
Smoothing filters Gaussian (contd)
  • s controls the amount of smoothing
  • As s increases, more samples must be obtained to
    represent
  • the Gaussian function accurately.

s 3
23
Smoothing filters Gaussian (contd)
24
Averaging vs Gaussian Smoothing
Averaging
Gaussian
25
Smoothing Filters Median Filtering(non-linear)
  • Very effective for removing salt and pepper
    noise (i.e., random occurrences of black and
    white pixels).

median filtering
averaging
26
Smoothing Filters Median Filtering (contd)
  • Replace each pixel by the median in a
    neighborhood around the pixel.

27
Sharpening Filters (High Pass filtering)
  • Useful for emphasizing transitions in image
    intensity (e.g., edges).

28
Sharpening Filters (contd)
  • Note that the response of high-pass filtering
    might be negative.
  • Values must be re-mapped to 0, 255

sharpened images
original image
29
Sharpening Filters Unsharp Masking
  • Obtain a sharp image by subtracting a lowpass
    filtered (i.e., smoothed) image from the original
    image

-

30
Sharpening Filters High Boost
  • Image sharpening emphasizes edges but details
    (i.e., low frequency components) might be lost.
  • High boost filter amplify input image, then
    subtract a lowpass image.

(A-1)


31
Sharpening Filters Unsharp Masking (contd)
  • If A1, we get a high pass filter
  • If Agt1, part of the original image is added back
    to the high pass filtered image.

32
Sharpening Filters Unsharp Masking (contd)
A1.9
A1.4
33
Sharpening Filters Derivatives
  • Taking the derivative of an image results in
    sharpening the image.
  • The derivative of an image can be computed using
    the gradient.

 
34
Sharpening Filters Derivatives (contd)
  • The gradient is a vector which has magnitude and
    direction

or
(approximation)
35
Sharpening Filters Derivatives (contd)
  • Magnitude provides information about edge
    strength.
  • Direction perpendicular to the direction of the
    edge.

 
36
Sharpening Filters Gradient Computation
  • Approximate gradient using finite differences

37
Sharpening Filters Gradient Computation (contd)
38
Example
39
Sharpening Filters Gradient Computation (contd)
  • We can implement and using masks

(x1/2,y)
good approximation at (x1/2,y)
(x,y1/2)


good approximation at (x,y1/2)
  • Example approximate gradient at z5

40
Sharpening Filters Gradient Computation (contd)
  • A different approximation of the gradient

good approximation
(x1/2,y1/2)
  • We can implement and using the
    following masks

41
Sharpening Filters Gradient Computation (contd)
  • Example approximate gradient at z5
  • Other approximations

Sobel
42
Example
43
Sharpening Filters Laplacian
The Laplacian (2nd derivative) is defined as
(dot product)
Approximate derivatives
44
Sharpening Filters Laplacian (contd)
Laplacian Mask
detect zero-crossings
45
Sharpening Filters Laplacian (contd)
Sobel
Laplacian
Write a Comment
User Comments (0)
About PowerShow.com