Professional Documents
Culture Documents
Chapter 3. Intensity Transformation and Spatial Filtering
Chapter 3. Intensity Transformation and Spatial Filtering
Image Histogram/Processing
Histogram Equalization
Summary
2
Outline
Local Histogram processing
3
3.3.3 Local Histogram Processing
4
3.3.3 Local Histogram Processing: Example
(P 161)
5
3.3.4 Using Histogram Statistics
for Image Enhancement
The nth moment of r about its mean: (from section 2.6.8)
L 1
un (r ) (ri m) n p (ri )
i 0
Average Intensity m:
L 1 M 1 N 1
1
m ri p (ri )
MN
f ( x, y )
x 0 y 0
i 0
Variance = the second moment:
L 1 M 1 N 1
1
u2 (r ) (ri m) p(ri ) f ( x, y ) m
2 2 2
MN x 0 y 0
i 0
6
Using Histogram Statistics for Image
Enhancement
Let S denote a neighborhood of any pixel (x,y):
example: S size can be 3x3
Local average intensity
L 1
msxy ri psxy (ri )
i 0
Local variance
L 1
s2xy (ri msxy ) 2 psxy (ri ) 7
i 0
3.4 Spatial Filtering (p 166)
Spatial filter
mask
Image section
under filter 9
Spatial Correlation
a=(m-1)/2, b=(m-1)/2
Ex) an image of size MxN with a filter of size mxn
m=3, n=3 a=(3-1)/2= 2/2=1, b=1
10
Spatial Convolution
a b
w( x, y ) f ( x, y ) w(s, t ) f ( x s, y t )
s a t b
s= -1, t= -1, w(-1,-1) f(x+1, y+1)
-1, 0, w(-1, 0) f(x+1, y)
-1, 1, w(-1, 1) f(x+1, y-1)
0, -1, w( 0,-1) f(x, y+1)
0, 0, w( 0, 0) f(x, y)
0, 1, w( 0, 1) f(x, y-1)
1, -1, w( 1,-1) f(x-1, y+1)
1, 0, w( 1, 0) f(x-1, y) 11
1, 1, w( 1, 1) f(x-1, y-1)
Correlation
Convolution
12
13
Smoothing Spatial Filters
14
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
where m 2a 1, n 2b 1.
15
Two Smoothing Averaging Filter Masks
16
1 1 1 1 1
1 1 1
1 1 1 1 1
1 1 1
1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
17
Example: Gross Representation of Objects
18
Order-statistic (Nonlinear) Filters
— Nonlinear
19
Example: Use of Median Filtering for Noise Reduction
20
Sharpening Spatial Filters
► Foundation
► Laplacian Operator
21
Sharpening Spatial Filters: Foundation
f
f ( x 1) f ( x)
x
2 f
f ( x 1) f ( x 1) 2 f ( x)
x 2
22
23
Sharpening Spatial Filters: Laplace Operator
2
f 2
f
f 2 2
2
x y
2 f
f ( x 1, y ) f ( x 1, y ) 2 f ( x, y )
x 2
2 f
f ( x, y 1) f ( x, y 1) 2 f ( x, y )
y 2
2 f f ( x 1, y ) f ( x 1, y ) f ( x, y 1) f ( x, y 1)
- 4 f ( x, y )
24
Sharpening Spatial Filters: Laplace Operator
25
Sharpening Spatial Filters: Laplace Operator
g ( x, y ) f ( x, y ) c 2 f ( x, y )
where,
f ( x, y ) is input image,
g ( x, y ) is sharpenend images,
c -1 if 2 f ( x, y ) corresponding to Fig. 3.37(a) or (b)
and c 1 if either of the other two filters is used.
26
27
Unsharp Masking and Highboost Filtering
► Unsharp masking
Sharpen images consists of subtracting an unsharp (smoothed)
version of an image from the original image
e.g., printing and publishing industry
► Steps
1. Blur the original image
28
Unsharp Masking and Highboost Filtering
29
Unsharp Masking: Demo
30
Unsharp Masking and Highboost Filtering: Example
31
Image Sharpening based on First-Order Derivatives
M ( x, y ) | g x | | g y |
z1 z2 z3
M ( x, y ) | z8 z5 | | z6 z5 |
z4 z5 z6
z7 z8 z9
33
Image Sharpening based on First-Order Derivatives
Sobel Operators
M ( x, y ) | ( z7 2 z8 z9 ) ( z1 2 z2 z3 ) |
z1 z2 z3 | ( z3 2 z6 z9 ) ( z1 2 z4 z7 ) |
z4 z5 z6
z7 z8 z9
34
Image Sharpening based on First-Order Derivatives
f’(x)=f(x+1)-f(x)
f’(y)=f(y+1)-f(y)
x 35
Example
36
Example:
Combining
Spatial
Enhancement
Methods
Goal:
Enhance the
image by
sharpening it
and by bringing
out more of the
skeletal detail
37
Example:
Combining
Spatial
Enhancement
Methods
Goal:
Enhance the
image by
sharpening it
and by bringing
out more of the
skeletal detail
38