Академический Документы
Профессиональный Документы
Культура Документы
Lecture 3
Sankalp Kallakuri
elsanky@gmail.com
Spatial Filtering
• Involves moving a kernel over the image to enhance the
image
• Kernel size is << Image size
• Odd sized masks are more common
Spatial Filtering
m(-1,-1) m(0,-1) m(1,-1)
• Near the edges parts of the masks may lie beyond the image
boundary.
Examples
1 1 1 1 2 1
1/9 x 1 1 1 1/16 x 2 4 2
1 1 1 1 2 1
Smoothing Spatial Filters
m( s , t ) f ( x s , y t )
g ( x, y ) s at b
a b
m( s , t )
s at b
3 6 9 12
Order Statistic Filters
5432100060000131000077777
-1-1-1-1-1 0 0 6 -6 0 0 0 1 2 -2 -1 0 0 0 7 0 0 0 0
-1 0 0 0 0 1 0 6 -12 6 0 0 1 1 -4 -1 1 0 0 7 -7 0 0
Summary of First and Second Order
Derivatives
• First Order Derivatives Generally Produce Thicker
Edges.
x y
Partial Double 2 f
Derivative in Y direction f ( x, y 1) f ( x, y 1) 2 f ( x, y )
y 2
2 f
Partial Double f ( x 1, y ) f ( x 1, y ) 2 f ( x, y )
Derivative in X direction x 2
2 f [ f ( x 1, y) f ( x 1, y) f ( x, y 1) f ( x, y 1)] 4 f ( x, y)
Digital implementation of the laplacian operator
Laplacian
0 1 0 1 1 1
1 -4 1 1 -8 1
0 1 0 1 1 1
Isotropic for 900 Isotropic for 450
f ( x, y) 2 f ( x, y)
g ( x, y ) =
{ f ( x, y) 2 f ( x, y)
-ve center coeff
+ve center coeff
Example : Laplacian
Original Difference
Combined Implementation
g ( x, y) f ( x, y) [ f ( x 1) f ( x 1, y)
f ( x, y 1) f ( x, y 1)] 4 f ( x, y)
g ( x, y) 5 f ( x, y ) [ f ( x 1) f ( x 1, y )
f ( x, y 1) f ( x, y 1)]
0 -1 0 -1 -1 -1
-1 5 -1 -1 9 -1
0 -1 0 -1 -1 -1
laplacian
Original
Combined
Unsharp Masking and High Boost Filtering
A f ( x, y) f ( x, y)
2
{
-ve center coeff
-1 A+4 -1 f hb =
A f ( x, y) f ( x, y)
2
+ve center coeff
0 -1 0
f [Gx Gy ]
2 2 1/ 2
Magnitude of gradient
2 1/ 2
f f
2
=
x y
f | Gx | | Gy | Gradient approximated
By absolute values
Gradient Masks
0 -1 1 0 Robert cross
operators
1 0 0 -1
Sobel
-1 -2 -1 -1 0 1 Operators
0 0 0 -2 0 2
1 2 1 -1 0 1
HW 2-B
• Repeat HW 2 with a triangle cropping.
• Equilateral with the coordinates of
centroid same as coordinates of 3L/4,3L/4.
• One edge of the triangle is at 125 degrees
to the bottom edge of the image.
• Edge length of the triangle is 30.
• DUE at same time as HW -2.