Sharpening Spatial Filter PDF
Sharpening Spatial Filter PDF
Stefano Ferrari
Sharpening
2f
= f (x + 1) f (x) (f (x) f (x 1))
x 2
= f (x + 1) 2f (x) + f (x 1)
Laplacian
I Usually the sharpening filters make use of the second order
operators.
I A second order operator is more sensitive to intensity
variations than a first order operator.
I Besides, partial derivatives has to be considered for images.
I The derivative in a point depends on the direction along which
it is computed.
I Operators that are invariant to rotation are called isotropic.
I Rotate and differentiate (or filtering) has the same effects of
differentiate and rotate.
I The Laplacian is the simpler isotropic derivative operator (wrt.
the principal directions):
2f 2f
2 f = +
x 2 y 2
Laplacian filter
I In a digital image, the second derivatives wrt. x and y are
computed as:
2f
= f (x + 1, y ) 2f (x, y ) + f (x 1, y )
x 2
2f
= f (x, y + 1) 2f (x, y ) + f (x, y 1)
y 2
I Hence, the Laplacian results:
2 f (x, y ) = f (x + 1, y ) + f (x 1, y ) + f (x, y + 1)
+f (x, y 1) 4f (x, y )
2 f (x, y ) + f (x 1, y 1) + f (x + 1, y + 1)
+ f (x 1, y + 1) + f (x + 1, y 1) 4f (x, y )
Unsharp masking
g = f + k (f f h)
original image
defocused image
unsharping mask
unsharped image
highboosted image
Gradient
I The gradient of a function is the vector formed by its partial
derivatives.
I For a bidimensional function, f (x, y ):
" # f
gx x
f grad(f ) =
f
gy
y
I The gradient vector points toward the direction of maximum
variation.
I The gradient magnitude, M(x, y ) is:
q
M(x, y ) = mag(f ) = gx2 + gy2
Derivative operators
I Basic definitions:
gx (x, y ) = f (x + 1, y ) f (x, y )
-1
gx : -1 1 gy :
1
I Roberts operators:
gx (x, y ) = f (x + 1, y + 1) f (x, y )
gy (x, y ) = f (x, y + 1) f (x 1, y )
-1 0 0 -1
gx : gy :
0 1 1 0
gx (x, y ) = f (x 1, y 1) 2f (x 1, y )
f (x 1, y + 1) + f (x + 1, y 1)
+ 2f (x + 1, y ) + f (x + 1, y + 1)
gy (x, y ) = f (x 1, y 1) 2f (x, y 1)
f (x + 1, y 1) + f (x 1, y + 1)
+ 2f (x, y + 1) + f (x + 1, y + 1)
-1 -2 -1 -1 0 1
gx : 0 0 0 gy : -2 0 2
1 2 1 -1 0 1
Combined methods
I The intensity
transformation make
the noise more visible,
but also enhance
other details, such as
the tissues around the
skeleton.
(e) (f)
Bilateral Filtering *
Giving f an image, g is the image after bilateral filtering:
1 X ||q p||2 ||f (q) f (p)||2
g (p) = exp exp f (q)
Wp s2 i2
qNp
Bilateral Filtering *
Bilateral Filtering *