sharpening spatial filters
TRANSCRIPT
DIGITAL IMAGE PROCESSING
SHARPENING PROCESS IN SPATIAL DOMAINPrepared by
T. Sathiyabama M. Sahaya Pretha
K. Shunmuga PriyaR. Rajalakshmi
Department of Computer Science and Engineering,MS University, Tirunelveli
05/03/2023 11:41 AM 2
DefinitionDirect Manipulation of image Pixels.The objective of Sharpening is to highlight
transitions in intensityThe image blurring is accomplished by pixel
averaging in a neighborhood.Since averaging is analogous to integration.
05/03/2023 11:41 AM 3
Some ApplicationsPhoto EnhancementMedical image visualizationIndustrial defect detectionElectronic printing Autonomous guidance in military
systems
05/03/2023 11:41 AM 4
FoundationSharpening Filters to find details about
Remove blurring from images.Highlight edges
We are interested in the behavior of these derivatives in areas of constant gray level(flat segments), at the onset and end of discontinuities(step and ramp discontinuities), and along gray-level ramps.
These types of discontinuities can be noise points, lines, and edges.
05/03/2023 11:41 AM 5
Definition for a first derivativeMust be zero in flat segments
Must be nonzero at the onset of a gray-level step or ramp
Must be nonzero along rampsA basic definition of the first-order derivative of a one-
dimensional function f(x) is
(Diff b/w subsequent values & measures the rate of change of the function)
)()1(f xfxfx
05/03/2023 11:41 AM 6
Definition for a second derivativeMust be zero in flat areas
Must be non zero at the onset and end of a gray-level step or ramp
Must be zero along ramps of constant slopeWe define a second-order derivative as the difference
(the values both before& after the
current value)
)(2)1()1(2
2
xfxfxfxf
05/03/2023 11:41 AM 7
First and second-order derivatives in digital form => difference
The 1st-order derivative is nonzero along the entire ramp, while the 2nd-order derivative is nonzero only at the onset and end of the ramp.
The response at and around the point is much stronger for the 2nd- than for the 1st-order derivative.
)()1( xfxfxf
)(2)1()1(
)]1()([)]()1([2
2
xfxfxf
xfxfxfxfxf
05/03/2023 11:41 AM 8
Gray-level profile
660 12300 2 22 2233 33 300 00000077 5576543210
05/03/2023 11:41 AM 9
Derivative of image profile
0 0 0 1 2 3 2 0 0 2 2 6 3 3 2 2 3 3 0 0 0 0 0 0 7 7 6 5 5 3
0 0 1 1 1-1-2 0 2 0 4-3 0-1 0 1 0-3 0 0 0 0 0-7 0-1-1 0-2
0-1 0 0-2-1 2 2-2 4-7 3-1 1 1-1-3 3 0 0 0 0-7 7-1 0 1-2
first
second
05/03/2023 11:41 AM 10
2nd derivatives for image Sharpening 2-D 2nd derivatives => Laplacian
2
2
2
22
yf
xff
),(4)]1,()1,(),1(),1([)],(2)1,()1,([ )],(2),1(),1([2
yxfyxfyxfyxfyxfyxfyxfyxfyxfyxfyxff
=>discrete formulation
05/03/2023 11:41 AM 11
Implementation
),(),(),(),(
),(2
2
yxfyxfyxfyxf
yxg
),(2 yxf
If the center coefficient is negative
If the center coefficient is positive
Where f(x,y) is the original image
is Laplacian filtered image
g(x,y) is the sharpen image
05/03/2023 11:41 AM 12
Definition of 2nd derivatives in filter mask
900 rotationinvariant
450 rotationinvariant(include Diagonals)
4 -
-
-
- -
- - -
-
---
8
05/03/2023 11:41 AM 13
Implementation
05/03/2023 11:41 AM 14
ImplementationFiltered = Conv(image,mask)
05/03/2023 11:41 AM 15
Implementationfiltered = filtered - Min(filtered) filtered = filtered * (255.0/Max(filtered))
05/03/2023 11:41 AM 16
Implementationsharpened = image + filtered sharpened = sharpened - Min(sharpened ) sharpened = sharpened * (255.0/Max(sharpened ))
05/03/2023 11:41 AM 17
Algorithm1. Using Laplacian filter to original image
2. And then add the image result from step 1 and the original image
3. We will apply two step to be one mask),(4)1,()1,(),1(),1(),(),( yxfyxfyxfyxfyxfyxfyxg
)1,()1,(),1(),1(),(5),( yxfyxfyxfyxfyxfyxg
05/03/2023 11:41 AM 18
Result of Algorithm
-1
-1
5 -1
-1
0 0
0 0
-1
-1
9 -1
-1
-1 -1
-1 -1
05/03/2023 11:41 AM 19
Laplacian filtering: example
Original image
Laplacian filtered image
05/03/2023 11:41 AM 20
Unsharp masking A process to sharpen images consists of
subtracting a blurred version of an image from the image itself. This process, called unsharp masking, is expressed as ),(),(),( yxfyxfyxf s
),( yxf s),( yxf),( yxf
Where denotes the sharpened image obtained by unsharp masking, an is a blurred version of
05/03/2023 11:41 AM 21
High-boost filtering A high-boost filtered image, fhb is defined
at any point (x,y) as
1),(),(),( AwhereyxfyxAfyxfhb
),(),(),()1(),( yxfyxfyxfAyxfhb
),(),()1(),( yxfyxfAyxf shb
This equation is applicable general and does not state explicity how the sharp image is obtained
05/03/2023 11:41 AM 22
High-boost filtering and Laplacian If we choose to use the Laplacian, then
we know fs(x,y)
),(),(),(),(
2
2
yxfyxAfyxfyxAf
fhbIf the center coefficient is negative
If the center coefficient is positive
-1
-1
A+4 -1
-1
0 0
0 0
-1
-1
A+8 -1
-1
-1 -1
-1 -1
05/03/2023 11:41 AM 23
The Gradient (1st order derivative) First Derivatives in image processing are
implemented using the magnitude of the gradient.
The gradient of function f(x,y) is
yfxf
GG
fy
x
05/03/2023 11:41 AM 24
The magnitude of this vector is given by
yxyx GGGGfmag 22)(
-1 1
1
-1
Gx
Gy
This mask is simple, and no isotropic. Its result only horizontal and vertical.
05/03/2023 11:41 AM 25
Robert’s Method The simplest approximations to a first-
order derivative that satisfy the conditions stated in that section are
268
259 )()( zzzzf
6859 zzzzf
z1 z2 z3
z4 z5 z6
z7 z8 z9
Gx = (z9-z5) and Gy = (z8-z6)
05/03/2023 11:41 AM 26
These mask are referred to as the Roberts cross-gradient operators.
-1 0
0 1
-10
01
05/03/2023 11:41 AM 27
Sobel’s Method Using this
equation)2()2()2()2( 741963321987 zzzzzzzzzzzzf
-1 -2 -1
0 0 0
1 2 1 1
-2
10
0
0-1
2
-1
05/03/2023 11:41 AM 28
Gradient: example
defectsoriginal(contact lens) Sobel gradient
Enhance defects and eliminate slowly changing background
05/03/2023 11:41 AM 29
Thank You to all my viewers