Title | Cp467 12 lecture 6 sharpening |
---|---|
Author | Aman Rai |
Course | DIP |
Institution | Visvesvaraya Technological University |
Pages | 33 |
File Size | 1.4 MB |
File Type | |
Total Downloads | 47 |
Total Views | 125 |
useful ppt on dip, has some intuitive information...
Lecture 6 Sharpening Filters 1. 2 2. 3. 4. 5. 6. 7.
The concept of sharpening filter First and second order derivatives Laplace filter Unsharp mask High boost filter Gradient mask Sharpening image with MatLab
Sharpening Spatial Filters • To highlight fine detail in an image or to enhance detail that has been blurred, either in error or as a natural effect ff t off a particular ti l method th d off image i acquisition. i iti • Blurring vs vs. Sharpening • Blurring/smooth is done in spatial domain by pixel averaging in a neighbors, i hb it iis a process off integration i t ti
• Sh Sharpening i iis an inverse i process, to t find fi d th the difference diff by b the th neighborhood, done by spatial differentiation.
2
Derivative operator • The strength of the response of a derivative operator is proportional to the degree of discontinuity of the image at the point at which the operator is applied. • 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 onedimensional 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
∂2 f = f ( x + 1) + f ( x − 1) − 2 f ( x) 2 ∂x
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.
Gradient operator (linear operator)
∂f ( x , y ) ∂f ( x, y ) ∂f ( x, y ) ∇f = = + ∂x∂y ∂x ∂y
Laplacian operator (non-linear)
2 2 ∂ ∂ f ( x , y ) f ( x, y ) 2 ∇ f = + 2 ∂x ∂y 2
7
Discrete form of Laplacian from
∂2 f = f ( x + 1, y) + f ( x − 1, y ) − 2 f ( x, y ) 2 ∂x ∂2 f = f ( x, y + 1) + f ( x, y − 1) − 2 f ( x, y ) 2 ∂y
∇ 2 f = [ f ( x + 1, y ) + f ( x − 1, y ) + 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
give the same result, but we have to keep in mind that when combining (add / subtract) a Laplacian-filtered i image with ith another th image. i 11
Effect of Laplacian Operator • as it is a derivative operator, – it highlights gray-level discontinuities in an image – it deemphasizes regions with with slowly slowly varying varying gray gray levels levels
• tends to produce images that have – grayish edge lines and other discontinuities, all superimposed on a dark, dark – featureless background.
12
Correct the effect of featureless background • easily by adding the original and Laplacian image. • be careful with the Laplacian filter used
⎧ f ( x, y ) − ∇ 2 f ( x, y ) g ( x, y ) = ⎨ 2 + ∇ f ( x , y ) f ( x, y ) ⎩
if the h center coefficient ffi i of the Laplacian mask is negative
if the center coefficient of the Laplacian mask is positive
13
Example • a). image of the North pole of the moon • b). Laplacian-filtered image with 1
1
1
1
-8
1
1
1
1
• c). Laplacian image scaled for display purposes • d). image enhanced by addition with original image 14
Mask of Laplacian + addition • to simply the computation, we can create a mask which do both operations, Laplacian Filter and Addition the original i i l image. i
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
5
-1
0
-1
0
16
Example
17
Note
⎧ f ( x, y ) − ∇ 2 f ( x, y ) g ( x, y) = ⎨ 2 + ∇ f ( x , y ) f ( x, y ) ⎩ 0
0
0
0
1
0
0
0
0
-1
0
0
-1
9
-1
0
-1
0
0
-1 1
0
-1
5
-1
0
-1
0
=
=
0
-1
0
-1
4
-1
0
0
-1
0
0
0
0
-1
0
0
1
0
-1
8
-1
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 • to subtract a blurred version of an image produces sharpening output image.
19
Unsharp mask
High-boost filtering
f hb ( x, y ) = Af ( x , y ) − f ( x, y ) fhb(x, y) = (A−1) f (x, y)− f (x, y) f (x, y) = (A−1) f (x, y) − fs (x, y) • generalized form of Unsharp masking • A≥ 1
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 ) = ⎨ 2 + ∇ ( , ) f x y f ( x, y ) ⎩
⎧ Af ( x , y ) − ∇ 2 f ( x , y ) f hb ( x, y) = ⎨ 2 Af x y + ∇ f ( x, y ) ⎩ ( , ) 23
High-boost Masks
A≥1 if A = 1, 1 it becomes “standard” standard Laplacian sharpening
24
Example
25
Gradient Operator • first derivatives are implemented using the magnitude of the gradient. gradient ⎡ ∂∂ff ⎤ ⎡Gx ⎤ ⎢ ∂x ⎥ ∇f = ⎢ ⎥ = ⎢ ∂ f ⎥ Gy ⎦ ⎢ ⎥ ⎣ 1 2 2 2 ⎢⎣ ∂ y ⎦⎥ ∇ f = mag (∇f ) = [G + G ] x
⎡⎛ ∂f ⎞ ⎛ ∂f ⎞ ⎤ = ⎢⎜ ⎟ + ⎜⎜ ⎟⎟ ⎥ ⎢⎣⎝ ∂x ⎠ ⎝ ∂y ⎠ ⎥⎦ 2
2
y
1 2
commonly approx.
∇f ≈ Gx + G y
the magnitude becomes nonlinear 26
Gradient Mask • simplest approximation, 2x2
Gx = ( z8 − z5 ) ∇f = [G + G ] 2 x
2 y
1
and 2
z1
z2
z3
z4
z5
z6
z7
z8
z9
G y = ( z 6 − z5 )
= [( z8 − z 5 ) + ( z 6 − z 5 ) ] 2
2
1
2
∇f ≈ z8 − z5 + z6 − z5 27
Gradient Mask
z1 z4
z2 z5
z3 z6
• Roberts cross-gradient operators, 2x2
z7
z8
z9
Gx = ( z9 − z5 ) ∇f = [G + G ] 2 x
2 y
1
and 2
Gy = ( z8 − z6 )
= [( z 9 − z5 ) + ( z 8 − z6 ) ] 2
2
1
2
∇f ≈ z9 − z 5 + z8 − z 6
28
Gradient Mask
z1 z4
z2 z5
z3 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 + z 7 ) ∇f ≈ Gx + 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
• want to sharpen the original image and bring out more skeletal detail. • problems: narrow dynamic range of gray level and high noise content makes the image difficult to enhance
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...