Lecture 3 - Chap 3
Lecture 3 - Chap 3
Spatial Filtering
Spatial Domain vs. Transform Domain
► Spatial domain
image plane itself, directly process the intensity values of
the image plane
► Transform domain
process the transform coefficients, not directly process the
intensity values of the image plane
10/11/2015 2
Spatial Domain Process
g ( x , y ) T [ f ( x , y)])
f (x , y) : input image g (
x , y) : output image
10/11/2015 3
Spatial Domain Process
Intensity transformation
function s T ( r)
10/11/2015
Some Basic Intensity Transformation
Functions
10/11/2015
Example: Log Transformations
10/11/2015
Example: Log Transformations
10/11/2015
Power-Law (Gamma) Transformations
s cr
10/11/2015
Example: Gamma Transformations
10/11/2015
Example: Gamma Transformations
Cathode ray tube
(CRT) devices have an
intensity-to-voltage
response that is a
power function, with
exponents varying
from approximately 1.8
to 2.5
s r1/2.5
10/11/2015 10
Example: Gamma Transformations
10/11/2015
Transformations
► Contrast Stretching
— Expands the range of intensity levels in an image so that it spans
the full intensity range of the recording medium or display device.
► Intensity-level Slicing
— Highlighting a specific range of intensities in an image often is
of interest.
10/11/2015
12
10/11/2015 13
Highlight the major
blood vessels and
study the shape of the
flow of the contrast
medium (to detect
blockages, etc.)
10/11/2015
Bit-plane Slicing
Bit-plane Slicing
10/11/2015
Histogram Processing
► Histogram Equalization
► Histogram Matching
10/11/2015 18
Histogram Processing
Histogram h ( rk ) nk
rk is the k th intensity value
nk is the number of pixels in the image with intensity rk
nk
Normalized histogram p ( rk )
MN
nk : the number of pixels in the image
of size M N with intensity rk
10/11/2015 19
10/11/2015 20
10/11/2015 21
Histogram Equalization
The intensity levels in an image may be viewed
as random variables in the interval [0, L-1].
Let pr (r ) and p s (s) denote the probability density
function (PDF) of random variables r and s.
10/11/2015 22
Histogram Equalization
sT(r) 0 r L 1
23
Histogram Equalization
sT(r) 0 r L 1
ps ( s ) ds pr ( r ) dr
10/11/2015 24
Histogram Equalization
ds dT ( r ) d r
( L 1) 0
pr ( w) dw
dr dr dr
(L1)pr(r)
p pr ( r ) dr pr ( r ) pr ( r) 1
s ( s) ds ds ( L 1) pr ( r) L 1
dr
10/11/2015 25
Example: Histogram Equalization
10/11/2015
10/11/2015 27
10/11/2015 28
Example of Histogram
Equalization
10/11/2015
Question
Is histogram equalization always good?
No
10/11/2015
Histogram Matching
Histogram matching (histogram specification)
— generate a processed image that has a specified histogram
Let pr (r ) and p z ( z) denote the continous probability
density functions of the variables r and z . p z (z) is the
specified probability density function.
Let s be the random variable with the probability
r
s T ( r ) ( L 1)0 pr (w) dw
Define a random variable z with the probability
z
G ( z ) (L 1)0 p z (t ) dt s
10/11/2015 31
Histogram Matching: Procedure
► Obtain pr(r) from the input image and then obtain the values of s
r
s ( L 1) 0 pr ( w) dw
► Use the specified PDF and obtain the transformation function G(z)
z
G ( z ) ( L 1) 0 p z (t ) dt s
► Mapping from s to z
z G 1 ( s)
10/11/2015 32
Local Histogram Processing
10/11/2015 33
Local Histogram Processing: Example
10/11/2015
Using Histogram Statistics for Image
Enhancement
Average Intensity L1 1 M 1 N 1
m rp(r) f ( x , y)
ii MN x 0 y0
i0
Variance L1 1 M 1 N 1
u 2 ( r ) ( ri m) p ( ri )
2 2 2
f ( x, y ) m
i0 MN x 0 y0
10/11/2015 35
Using Histogram Statistics for Image
Enhancement
s
xy denotes a neighborhood
Local variance
L1
m ) 2 p (r )
(ri
2
s xy s xy s xy i
i0
10/11/2015
Using Histogram Statistics for Image
Enhancement: Example
10/11/2015
Convolution and Correlation
10/11/2015
Spatial Correlation
a b
w( x, y ) f (x , y ) w( s , t ) f (x s , y t)
s a t b
10/11/2015 39
Spatial Convolution
a b
10/11/2015 40
10/11/2015 41
Spatial Filtering
10/11/2015
Spatial Filtering
10/11/2015
Smoothing Spatial Filters
10/11/2015
Spatial Smoothing Linear Filters
w( s , t ) f (x s , y t)
g ( x, y) s a t b a b
w( s , t)
s a t b
10/11/2015 45
Two Smoothing Averaging Filter Masks
10/11/2015
10/11/2015 47
Example: Gross Representation of Objects
10/11/2015
Order-statistic (Nonlinear) Filters
— Nonlinear
10/11/2015
Example: Use of Median Filtering for Noise Reduction
10/11/2015 50
Sharpening Spatial Filters
► Foundation
► Laplacian Operator
10/11/2015 51
Sharpening Spatial Filters: Foundation
2f
f(x1)f(x1)2f(x)
x2
10/11/2015 52
53
Sharpening Spatial Filters: Laplace Operator
10/11/2015
Sharpening Spatial Filters: Laplace Operator
10/11/2015
Sharpening Spatial Filters: Laplace Operator
10/11/2015
Sharpening Spatial Filters: Laplace Operator
st nd
1 order derivative of Gaussian 2 order derivative of Gaussian
10/11/2015