Dip Chap03 2
Dip Chap03 2
Chapter 3:
Image Enhancement in the
Spatial Domain
20 April 2014
Logic Operations
Application:
Crop areas
of interest
AND
OR
Error
image
Degraded image
g ( x, y ) f ( x, y ) ( x, y )
(noise)
Image averaging
K
1
g ( x, y )
K
g ( x, y )
i 1
i
Pixel z
…
2 4 1 2 6 2
9 2 3 4 4 4 3 4 4
7 2 9 7 6 7 … 9 7 6 …
5 2 3 6 1 5 3 6 1
7 4 2 5 1 2
…
2 5 2 3 2 8
Basics of Spatial Filtering (cont.)
Step 2. Multiply every pixel by 1/9 and then sum up the values
…
3 4 4
… 9 7 6 …
1 1 1
3 6 1 y 3 4 4
9 9 9
…
1 1 1
9 7 6
X 9 9 9
1 1 1
1 1 1 1 3 6 1
Mask or 9 9 9
9 1 1 1 Window or
1 1 1 Template
Masking Window
Basics of Spatial Filtering (cont.)
Statistic parameters
Mean, Median, Mode,
Min, Max, Etc.
Moving
window
Output image
Order-Statistic Filters: Median Filter
Highlight fine detail in an image or to enhance detail that has been blurred.
There are intensity discontinuities near object edges in an image
Intensity profile 1
0.5 Edge
p(x)
0
20 40 60 80 100 120 140 160 180 200
0.2
1st derivative
0.1
dp
dx 0
0 50 100 150 200
0.05
2nd derivative
2 0
d p
dx 2 -0.05
0 50 100 150 200
Laplacian Sharpening : How it works (cont.)
1.5
p(x) 0.5
-0.5
0 50 100 150 200
1.5
1
2
d p
p( x ) 10 2 0.5
dx
0
-0.5
0 50 100 150 200
Before sharpening
p(x)
After sharpening
d2p
p( x ) 10 2
dx
Laplacian Masks
2 2
2 P P
Used for estimating image Laplacian P 2 2
x y
-1 -1 -1 0 -1 0
-1 8 -1 -1 4 -1 The center of the mask
is positive
-1 -1 -1 0 -1 0
or
1 1 1 0 1 0
The center of the mask
1 -8 1 1 -4 1 is negative
1 1 1 0 1 0
p 2 P
2 P P 2 P
Mask for
2
P P
0 -1 0 -1 -1 -1
-1 5 -1 or -1 9 -1
Mask for 0 -1 0 -1 -1 -1
2 P
1 1 1
1 -8 1
1 1 1
or
0 1 0
1 -4 1
0 1 0
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Unsharp Masking and High-Boost Filtering
-1 -1 -1 0 -1 0
-1 k+8 -1 -1 k+4 -1
-1 -1 -1 0 -1 0
Equation:
Intensity profile 1
dp
0.1
dx
0
0 50 100 150 200
First Order Partial Derivative:
Sobel operators
-1 0 1 -1 -2 -1
P P
-2 0 2 to compute 0 0 0 to compute
x y
-1 0 1 1 2 1
P P P
x y
First Order Partial Derivative: Image Gradient
Gradient magnitude
2 2
P P
P
x y
P
P y
P P
x
Image Enhancement in the Spatial Domain : Mix things up !
2 P
P
A B D smooth
+ -
Power
G
C E Law Tr.
F
A
Multiplication
H
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.