Spatial Filters For Image Enhancement
Spatial Filters For Image Enhancement
6 8 (Operator: sum)
12 200
6 8 2 0 226
12 200 20 10
Example 1:
N(p) = {(x,y): |x-xP|=1, |y-yP| = 1}
P P P
P P
P
P
P
N8
N24
N48
Carryout
• Blurring / Smoothing
• Sharpening
• Edge Detection
Blurring / Smoothing
((Sometimes also referred to as averaging or lowpass-filtering)
Purpose:
Blurring / Smoothing
1 1 1
1 1 1 * 1/9
1 1 1
Example 2:
Weighted average
1 2 1
2 4 2 * 1/16
1 2 1
Basic idea:
Weigh the center point the highest, decrease
weight by distance to center.
P = i ai ni / i ai
EDGE DETECTION
EDGE DETECTION
Purpose:
• Preprocessing
• Sharpening
Motivation: Derivatives
z
Spatial Filtering
derive
0 -1 0 0 0 0 0 -1 0
-1 4 -1 + 0 1 0 = -1 5 -1
0 -1 0 0 0 0 0 -1 0
Unsharp Masking
and
F
sharp =F–F blurred
0 -1 0 0 0 0 0 1 0
-1
0
a-1
-1
-1
0
= 0
0 0
a 0
0
- 1
0
1
1
1
0 -1 0
a=1
-1 0 -1
0 -1 0
0 -1 0
a=6
-1 5 -1
0 -1 0 0 -1 0
-1 b-1 -1 a=b
0 -1 0
Laplacian + Image !
Anuradha Phadke, ECE, MIT, Pune
Spatial Filtering
Prewitt Operators
Gx Gy
-1 -1 -1 -1 0 1
0 0 0 -1 0 1
1 1 1 -1 0 1
Sobel Operators
Gx Gy
-1 -2 -1 -1 0 1
0 0 0 -2 0 2
1 2 1 -1 0 1
Roberts Operators
Gx Gy
-1 0 0 -1
0 1 1 0
MEDIAN FILTERING
1 2 3 3 4 5 6 6 6 7 8 9 9