Lecture - 11 - 16 ImageEnhancement - Till - March1 - 2023
Lecture - 11 - 16 ImageEnhancement - Till - March1 - 2023
domain
BITS Pilani Rajitha
Hyderabad Campus
K
Image enhancement
f(x , g(x ,
Operatio
y) n y)
T(f( x ,
y))
Spatial
domain
• The operator T in spatial domain can
be defined over
1)The set of pixels (x, y) of the
image
2)The set of ‘neighbour’ N(x, y) of each
pixel
3)A set of images f1,f2,f3
( ) =T(
) Any Enhancement
technique
Enhanced Image(x,y)= T ( original Image
(x,y)
g(x,y)= T[f(x,y)]
Spatial domain approach
is performed in a
“neighborhood”
Image f(x,y)
x
(x,y)
y
Kern
al X
Y
bv1 bv2 bv C1 C2 C3 (Bv1 x c1 ) + (bv2 x
3 +(Bv3
c2) x c3 ) + (bv4 x
X C4 C5 C6 c4)
= +(Bv5 x c5 ) + (bv6 x
bv4 bv5 bv =
c6)
6 C7 C8 C9 +(Bv7 x c7 ) + (bv8 x
bv7 bv8 bv c8) (Bv9 x c9 )
9
Point Processing
WhenKernelsizebecomes 1x1thetechniqueisreferredtoaspointprocessing
OrGrayleveltransformations
bv1 bv bv3
2 X
= C5 = bv5 x
bv4 bv bv6 c5
5
bv7 bv bv9
8
Negative
Transformation
Replacing
the original
image gray
level value r
with 255-r
25
Output gray level
25
0 255
(s)
0 255
Input gray level Input gray level
Log
Transformation
25
5
Output gray level
255
Input gray level (r)
Dark area of input image
Fourier spectrum and log
transformation
Power- law
This is also called as GAMMA
TransformationsCORRECTION
General Equation is…..
s = crγ
25
5
25
5
Gamma
correction
Pixels
No. of
0 25
0 Grey
levels 5
Histograms of a color
Histograms of a Black and white
image
image
Understanding
Histograms .
0 25 0
5 25
5
Histogram statistics and contrast
Contrast stretching
ORIGINAL IMAGE
X
0 255
STRETCHED IMAGE
X’
0 255
X-Xmin
X’= X 255
Xmax- Xmin
Contrast stretching
STRETCHABLE AREA
Gray level Thresholding
Grey level thresholding is used to segment
an input image into two classes
It display a continuous image(0-255) to a
bi-level map(0-1)
0
Gray level Thresholding
20
frequency
frequency
10
5
50 60 70 154 0 255
Before Equalisation After Equalization
Histogram Equalization
Y
bv1 bv2 bv3 C1 C2 C3 (Bv1 x c1 ) + (bv2 x c2)
X +(Bv3 x c3 ) + (bv4 x c4)
= bv4 bv5 bv6 C4 C5 C6 = +(Bv5 x c5 ) + (bv6 x c6)
+(Bv7 x c7 ) + (bv8 x c8)
bv7 bv8 bv9 C7 C8 C9 (Bv9 x c9 )
Linear filtering techniques
• Correlation
a b
g ( x, y ) w( x, y ) * f ( x, y ) w(s, t ) f ( x s, y t )
s at b
• Convolution
a b
g ( x, y ) w( x, y ) f ( x, y ) w(s, t ) f ( x s, y t )
s at b
Generating spatial filter masks
• Selection of coefficients for linear filtering masks depends
upon the type of application
1 1 1
1 1 1
1 1 1
1 2 1
2 4 2
1 2 1
Gaussian Filter
Order statistics (non-linear filters)
f
f ( x 1) f ( x)
x
Gray-level 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
7
6
5
4
3
2
1
0
1st make thick edge and 2nd make thin edge
2
f 2
f
f 2 2
2
x y
Discrete form of derivative
f(x,y-1)
2 f
f(x,y) f ( x, y 1) f ( x, y 1) 2 f ( x, y)
y 2
f(x,y+1)
2-Dimentional Laplacian
The digital implementation of the 2-Dimensional
Laplacian is obtained by summing 2 components
2 f 2 f
f 2 2
2
x y
2 f f ( x 1, y) f ( x 1, y) f ( x, y 1) f ( x, y 1) 4 f ( x, y)
1 -4 1
1
Laplacian
0 1 0 1 1 1
1 -4 1 1 -8 1
0 1 0 1 1 1
1 0 1
0 -4 0
1 0 1
Implementation
* By applying laplacian to image it highlight the edges
but deemphasizes slow varying intensity areas. In to
recover the background details we add original
image to laplacian output.
z4 z51 z6 f ( z9 z5 ) 2 ( z8 z6 ) 2
z7 z8 z9
f z9 z5 z8 z6
Robert’s Method
-1 0 0 -1
0 1 1 0
-1 -2 -1 -1 0 1
0 0 0 -2 0 2
1 2 1 -1 0 1
• Gradients enhances small discontinuities
in flat gray fields
Original image Laplacian image
Sharpened image Sobel image
(original+ Laplacian)
Mask image obtained
Smoothened sobel
by multipying sobel
image)
smoothened and
laplacian sharp
Sharpened image Power law
(original image +mask transformation