image enhancement in the spatial domain (part...
TRANSCRIPT
![Page 1: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/1.jpg)
Image Enhancement in the Spatial Domain (Part 5)
Lecturer: Dr. Hossam Hassan Email : [email protected]
Computers and Systems Engineering
![Page 2: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/2.jpg)
2
Correct the effect of featureless background
• easily by adding the original and Laplacian image.
• be careful with the Laplacian filter used
),(),(
),(),(),(
2
2
yxfyxf
yxfyxfyxg
if the center coefficient of the Laplacian mask is negative
if the center coefficient of the Laplacian mask is positive
![Page 3: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/3.jpg)
Example
Input Image Laplacian Result
![Page 4: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/4.jpg)
4
Mask of Laplacian + addition
• to simplify the computation, we can create a mask which does both operations, Laplacian Filter and Addition of the original image.
![Page 5: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/5.jpg)
5
Mask of Laplacian + addition
)]1,()1,(
),1(),1([),(5
)],(4)1,()1,(
),1(),1([),(),(
yxfyxf
yxfyxfyxf
yxfyxfyxf
yxfyxfyxfyxg
0 -1 0
-1 5 -1
0 -1 0
![Page 6: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/6.jpg)
6
Note
0 -1 0
-1 5 -1
0 -1 0
0 0 0
0 1 0
0 0 0
),(),(
),(),(),(
2
2
yxfyxf
yxfyxfyxg
= + 0 -1 0
-1 4 -1
0 -1 0
0 -1 0
-1 9 -1
0 -1 0
0 0 0
0 1 0
0 0 0
= + 0 -1 0
-1 8 -1
0 -1 0
![Page 7: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/7.jpg)
7
Un-sharp Masking
• to subtract a blurred version of an image produces sharpening output image.
),(),(),( yxfyxfyxfs
sharpened image = original image – blurred image
A process used for many years in the publishing industry to sharpen images consists of subtracting a blurred version of an image from the image itself. This process, called unsharp masking, is expressed as:-
![Page 8: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/8.jpg)
8
High-boost filtering
• generalized form of Unsharp masking
• A 1
),(),(),( yxfyxAfyxfhb
),(),()1(
),(),(),()1(),(
yxfyxfA
yxfyxfyxfAyxf
s
hb
![Page 9: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/9.jpg)
9
High-boost filtering
• if we use Laplacian filter to create sharpen image fs(x,y) with addition of original image
),(),()1(),( yxfyxfAyxf shb
),(),(
),(),(),(
2
2
yxfyxf
yxfyxfyxfs
![Page 10: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/10.jpg)
10
High-boost filtering
• yields
),(),(
),(),(),(
2
2
yxfyxAf
yxfyxAfyxfhb
if the center coefficient of the Laplacian mask is negative
if the center coefficient of the Laplacian mask is positive
![Page 11: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/11.jpg)
11
High-boost Masks
A 1 if A = 1, it becomes “standard” Laplacian
sharpening
![Page 12: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/12.jpg)
12
Example (1)
![Page 13: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/13.jpg)
Example (2) Input Image Laplacian
A=1 A=1.2
https://docs.kde.org/development/en/extragear-graphics/showfoto/using-kapp.html
![Page 14: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/14.jpg)
Example (3) Input Image Laplacian
A=1 A=1.1
![Page 15: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/15.jpg)
15
Gradient Operator
• first derivatives are implemented using the magnitude of the gradient.
y
fx
f
G
Gf
y
x
21
22
21
22 ][)f(||||
y
f
x
f
GGmagf yx
the magnitude becomes nonlinear yx GGf ||||
commonly approx.
![Page 16: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/16.jpg)
16
Gradient Mask
• simplest approximation, 2x2
z1 z2 z3
z4 z5 z6
z7 z8 z9
)( and )( 5658 zzGzzG yx
21
2
56
2
582
122 ])()[(][|||| zzzzGGf yx
5658|||| zzzzf
![Page 17: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/17.jpg)
17
Gradient Mask
• Roberts cross-gradient operators, 2x2
z1 z2 z3
z4 z5 z6
z7 z8 z9
)( and )( 6859 zzGzzG yx
21
2
68
2
592
122 ])()[(][|||| zzzzGGf yx
6859|||| zzzzf
![Page 18: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/18.jpg)
18
Gradient Mask
• Sobel operators, 3x3
z1 z2 z3
z4 z5 z6
z7 z8 z9
)2()2(
)2()2(
741963
321987
zzzzzzG
zzzzzzG
y
x
yx GGf ||||
the weight value 2 is to achieve smoothing by giving more importance to the center point
![Page 19: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/19.jpg)
19
Note
• the summation of coefficients in all masks equals 0, indicating that they would give a response of 0 in an area of constant gray level.
![Page 20: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/20.jpg)
20
Example
![Page 21: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/21.jpg)
21
Edge Detection
• Why detect edge?
Edges characterize object boundaries and are
useful features for segmentation, registration
and object identification in scenes.
• What is edge (to human vision system)?
Intuitively, edge corresponds to singularities in the image
(i.e. where pixel value experiences abrupt change)
No rigorous definition exists
![Page 22: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/22.jpg)
22
Gradient Operators
• Motivation: detect changes
change in the pixel value large gradient
Gradient
operator image Thresholding
edge
map x(m,n) g(m,n) I(m,n)
otherwise
thnmgnmI
0
|),(|1),(
![Page 23: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/23.jpg)
23
Common Operators
Examples: 1. Roberts operator
01
10
g1 g2
10
01
),(),(),( 2
2
2
1 nmgnmgnmg
• Gradient operator
![Page 24: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/24.jpg)
24
Common Operators (cont’d)
2. Prewitt operator 3. Sobel operator
101
101
101
111
000
111
101
202
101
121
000
121
vertical
horizontal
![Page 25: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/25.jpg)
Input Image Vertical Component
Horizontal Component Prewit Gradient
Pre
witt
Gra
die
nt
Appro
xim
ation
![Page 26: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/26.jpg)
Eff
ect
of
Thre
sho
ldin
g P
aram
eter
s
Input Image Sobel Gradient Magnitude
Threshold = 20% of Max Threshold = 50% of Max
![Page 27: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/27.jpg)
27
Compass Operators
101
101
101
111
000
111
111
000
111
101
101
101
110
101
011
110
101
011
011
101
110
011
101
110
|}),({|max),( nmgnmg kk
![Page 28: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/28.jpg)
Co
mp
ass
Op
erat
or
Ex
amp
le
Input Image Compass Gradient Operator Results
Threshold = 20% of Max Threshold = 50% of Max
![Page 29: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/29.jpg)
Color Image: Image from Google HD
![Page 30: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/30.jpg)
Compass Gradient Operator Results
![Page 31: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/31.jpg)
Color Image: Image from Google HD
![Page 32: Image Enhancement in the Spatial Domain (Part 5)mct.asu.edu.eg/uploads/1/4/0/8/14081679/cse468-lec7.pdf · Image Enhancement in the Spatial Domain (Part 5) Lecturer: Dr. Hossam Hassan](https://reader034.vdocuments.site/reader034/viewer/2022042311/5eda022128db2d5ca2493e8d/html5/thumbnails/32.jpg)
Compass Gradient Operator Results