Documente Academic
Documente Profesional
Documente Cultură
• Blurring vs
vs. Sharpening
• Sh
Sharpening
i is
i an inverse
i process, tot find
fi d th
the diff
difference by
b the
th
neighborhood, done by spatial differentiation.
2
Derivative operator
• Image differentiation
– enhances edges and other discontinuities (noise)
– deemphasizes area with slowly varying gray-level
values.
values
3
Sharpening edge by First and second order derivatives
• Intensity function f =
f’
f
• First derivative f’ =
• Second-order derivative
f’’
f f’’
f-f
f’’ =
• f- f’’ =
4
First and second order difference of 1D
• The basic definition of the first-order derivative of a one-
dimensional function f(x) is the difference
∂f
= f ( x + 1) − f ( x)
∂x
• The second-order derivative of a one-dimensional
function f(x)
( ) is the difference
∂ f
2
= f ( x + 1) + f ( x − 1) − 2 f ( x)
∂x 2
5
First and Second-order derivative of 2D
• when we consider an image function of two variables,
f(x, y), at which time we will dealing with partial
d i ti
derivatives along
l th
the ttwo spatial
ti l axes.
∂f ( x, y ) ∂f ( x, y ) ∂f ( x, y )
Gradient operator ∇f = = +
∂x∂y ∂x ∂y
(linear operator)
∂ 2
f ( x , y ) ∂ 2
f ( x, y )
Laplacian
p operator
p ∇ f =
2
+
(non-linear) ∂x 2
∂y 2
7
Discrete form of Laplacian
from
∂ f
2
= 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
∇ f = [ f ( x + 1, y ) + f ( x − 1, y )
2
+ f ( x, y + 1) + f ( x, y − 1) − 4 f ( x, y )]
8
Result Laplacian mask
9
Laplacian mask implemented an extension of
diagonal neighbors
10
Other implementation of Laplacian masks
12
Correct the effect of featureless background
if th
the center
t coefficient
ffi i t
of the Laplacian mask is
⎧ f ( x, y ) − ∇ 2 f ( x, y ) negative
g ( x, y ) = ⎨
⎩ f ( x , y ) + ∇ 2
f ( x, y )
if the center coefficient
of the Laplacian mask is
positive
13
Example
15
Mask of Laplacian + addition
g ( x, y ) = f ( x, y ) − [ f ( x + 1, y ) + f ( x − 1, y )
+ f ( x, y + 1) + f ( x, y − 1) + 4 f ( x, y )]
= 5 f ( x, y ) − [ f ( x + 1, y ) + f ( x − 1, y )
+ f ( x, y + 1) + f ( x, y − 1)]
0 -1 0
-1
1 5 -1
1
0 -1 0
16
Example
17
Note
⎧ f ( x, y ) − ∇ f ( x, y )
2
g ( x, y ) = ⎨
⎩ f ( x, y ) + ∇ f ( x, y )
2
0 -1
1 0 0 0 0 0 -1 0
-1 5 -1 = 0 1 0 + -1 4 -1
0 -1 0 0 0 0 0 -1 0
0 -1
1 0 0 0 0 0 -1 0
-1 9 -1 = 0 1 0 + -1 8 -1
0 -1
1 0 0 0 0 0 -1
1 0
18
Unsharp masking
f s ( x, y ) = f ( x, y ) − f ( x, y )
sharpened image = original image – blurred image
19
Unsharp mask
High-boost filtering
f hb ( x, y ) = Af ( x, y ) − f ( x, y )
22
High-boost filtering
f hb ( x, y ) = ( A − 1) f ( x, y ) − f s ( x, y )
• if we use Laplacian filter to create sharpen image fs(x,y)
with addition of original image
⎧ f ( x, y ) − ∇ 2 f ( x, y )
f s ( x, y ) = ⎨
⎩ f ( x , y ) + ∇ 2
f ( x, y )
⎧ Af ( x, y ) − ∇ 2 f ( x, y )
f hb ( x, y ) = ⎨
⎩ Af ( x, y ) + ∇ f ( x, y )
2
23
High-boost Masks
A≥1
if A = 1,
1 it becomes “standard”
standard Laplacian sharpening
24
Example
25
Gradient Operator
= ⎢⎜ ⎟ + ⎜⎜ ⎟⎟ ⎥
⎢⎣⎝ ∂x ⎠ ⎝ ∂y ⎠ ⎥⎦
∇f ≈ G x + G y
the magnitude becomes nonlinear
26
Gradient Mask
z1 z2 z3
• simplest approximation, 2x2
z4 z5 z6
z7 z8 z9
G x = ( z8 − z 5 ) and G y = ( z 6 − z5 )
1 1
∇ f = [G + G ]
2
x
2
y
2
= [( z8 − z5 ) + ( z6 − z5 ) ]
2 2 2
∇ f ≈ z8 − z 5 + z 6 − z 5
27
Gradient Mask z1 z2 z3
z4 z5 z6
• Roberts cross-gradient operators, 2x2 z7 z8 z9
G x = ( z9 − z5 ) and G y = ( z8 − z 6 )
1 1
∇ f = [G + G ]
2
x
2
y
2
= [( z9 − z5 ) + ( z8 − z6 ) ]
2 2 2
∇ f ≈ z 9 − z 5 + z8 − z 6
28
Gradient Mask z1 z2 z3
z4 z5 z6
• Sobel operators, 3x3 z7 z8 z9
Gx = ( z7 + 2 z8 + z9 ) − ( z1 + 2 z 2 + z3 )
G y = ( z3 + 2 z6 + z9 ) − ( z1 + 2 z 4 + z7 )
∇f ≈ G x + G y
the weight value 2 is to
achieve smoothing by
giving more important
to the center point
29
Example
30
Example of Combining Spatial Enhancement Methods
31
Example of Combining Spatial Enhancement Methods
• solve :
1. Laplacian to highlight fine detail
2. gradient to enhance prominent edges
3. gray-level transformation to increase the dynamic
range of gray levels
32