0% found this document useful (0 votes)
53 views21 pages

DIP With Spatial

This document outlines content for the ECE 468/CS 519 Digital Image Processing course. It discusses spatial filtering in MATLAB, including image adjustment, histograms, and histogram equalization. It covers the differences between correlation and convolution for linear spatial filtering. Gaussian and smoothing filters are presented as examples of low-pass filters. The document demonstrates applying a smoothing filter to an image from the Hubble Space Telescope.

Uploaded by

Anonymous Neo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views21 pages

DIP With Spatial

This document outlines content for the ECE 468/CS 519 Digital Image Processing course. It discusses spatial filtering in MATLAB, including image adjustment, histograms, and histogram equalization. It covers the differences between correlation and convolution for linear spatial filtering. Gaussian and smoothing filters are presented as examples of low-pass filters. The document demonstrates applying a smoothing filter to an image from the Hubble Space Telescope.

Uploaded by

Anonymous Neo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

ECE 468 / CS 519:

Digital Image Processing

Spatial Filtering

Prof. Sinisa Todorovic

[email protected]

1
Outline

MATLAB

Smoothing spatial filters (Textbook: 3.5)

2
MATLAB

3
MATLAB

g = imadjust(f,[low_in; high_in],[low_out; high_out],gamma)

3
MATLAB

g = imadjust(f,[low_in; high_in],[low_out; high_out],gamma)

If high_out < low_out, the output is a photographic negative.

3
MATLAB

g = imadjust(f,[low_in; high_in],[low_out; high_out],gamma)

If high_out < low_out, the output is a photographic negative.

h = imhist(f, num_bins);% histogram

3
MATLAB

g = imadjust(f,[low_in; high_in],[low_out; high_out],gamma)

If high_out < low_out, the output is a photographic negative.

h = imhist(f, num_bins);% histogram

p = imhist(f, num_bins)/numel(f);% normalized histogram

3
MATLAB

g = imadjust(f,[low_in; high_in],[low_out; high_out],gamma)

If high_out < low_out, the output is a photographic negative.

h = imhist(f, num_bins);% histogram

p = imhist(f, num_bins)/numel(f);% normalized histogram

g = histeq(f, hspec), or g = histeq(f,256)

3
MATLAB

g = imadjust(f,[low_in; high_in],[low_out; high_out],gamma)

If high_out < low_out, the output is a photographic negative.

h = imhist(f, num_bins);% histogram

p = imhist(f, num_bins)/numel(f);% normalized histogram

g = histeq(f, hspec), or g = histeq(f,256)

hspec - counts of equally spaced intensity values in [0,255]

3
Linear Spatial Filtering

a b
g(x, y) = w(i, j)f (x + i, y + j)
i= a j= b

4
Linear Spatial Filtering

5
Correlation vs. Convolution

Correlation:
1. Move the filter mask to a location

2. Compute the sum of products

3. Go to 1. a b
w(x, y) f (x, y) = w(i, j)f (x + i, y + j)
i= a j= b

Convolution:
1. Rotate the filter mask by 180 degrees

2. Correlation
a b
w(x, y) f (x, y) = w(i, j)f (x i, y j)
i= a j= b
6
Example: Correlation vs. Convolution

7
Example: Correlation vs. Convolution

8
Example: Correlation vs. Convolution

9
Example: Correlation vs. Convolution

10
Gaussian Filter
x +y 2 2
N (x, y) = exp( )
2 2
3x3 filter:

w1 = N ( 1, 1), w2 = N ( 1, 0), . . . w9 = N (1, 1)

11
Smoothing Filter -- Low Pass Filter

spatial averaging weighted averaging

12
Example: Smoothing Filter

13
Application of Smoothing

an image from Hubble space telescope

input output thresholded

14
Application of Smoothing

15

You might also like