You are on page 1of 29

Digital image processing Chapter 6.

Image enhancement

IMAGE ENHANCEMENT
Introduction
Image enhancement algorithms & techniques
Point-wise operations
Contrast enhancement; contrast stretching
Grey scale clipping; image binarization (thresholding)
Image inversion (negative)
Grey scale slicing
Bit extraction
Contrast compression
Image subtraction
Histogram modeling: histogram equalization/ modification
Spatial operations
Spatial low-pass filtering
Unsharp masking and crispening
Spatial high-pass and band-pass filtering
Inverse contrast ratio mapping and statistical scaling
Magnification and interpolation (image zooming)


Transform domain image processing
Generalized linear filtering
Non-linear filtering
Generalized cepstrum and homomorphic filtering
Image pseudo-coloring
Color image enhancement
Applications: biomedical image enhancement
Types and characteristics of biomedical images
Contour detection in biomedical images
Anatomic segmentation of biomedical images
Histogram equalization and pseudo-coloring in biomedical images


Digital image processing Chapter 6. Image enhancement
Introduction

• Def.: Image enhancement = class of image processing operations whose goal is to
produce an output digital image that is visually more suitable as appearance for its visual
examination by a human observer
The relevant features for the examination task are enhanced
The irrelevant features for the examination task are removed/reduced

• Specific to image enhancement:
- input = digital image (grey scale or color)
- output = digital image (grey scale or color)

• Examples of image enhancement operations:
- noise removal;
- geometric distortion correction;
- edge enhancement;
- contrast enhancement;
- image zooming;
- image subtraction;
- pseudo-coloring.

• Classification of image enhancement operations:
- Based on the type of the algorithms: grey scale transformations; spatial operations;
transform domain processing; pseudo-coloring
- Based on the class of applications – as in the examples above.
Digital image processing Chapter 6. Image enhancement
A. Point-wise operations

Def.: The new grey level (color) value in a spatial location (m,n) in the resulting image depends
only on the grey level (color) in the same spatial location (m,n) in the original image
=> “point-wise” operation, or grey scale transformation (for grey scale images).


Digital image processing Chapter 6. Image enhancement
m m
n n
( )
{ } { }
Max Max
L L f
N n M m n m u f n m v
,..., 1 , 0 ,..., 1 , 0 :
; 1 ,..., 1 , 0 ; 1 ,..., 1 , 0 , ) , ( ) , (
÷
÷ = ÷ = ¬ =
U[M×N] V[M×N]

Point-wise operation
(grey scale transformation)
f(∙) =>v=f(u)

u(m,n) v(m,n) = f(u(m,n))

Contrast enhancement/contrast stretching


v
mu
n(u a) v
p(u b) v
,
,
,
0 u a
a u b
b u L
,
,
,
m tg
n tg
p tg
a
b
= ÷ +
÷ +
s s
s s
s s
=
=
=
¦
´
¦
¹
¦
o
|
¸

V

V
L

¸
V
b





|
V
a
o U
a b



Contrast enhancement, if:
- m<1, for the dark regions (under a~L/3).
- n>1, for the medium grey scale (between a and b, b~(2/3)L)
- p<1, for the bright regions (above b).

Digital image processing Chapter 6. Image enhancement
Grey scale clipping; image thresholding
•Grey scale clipping is a particular case of contrast enhancement, for m=p=0:


(6.2)

f(u)
0
nu
L
,
,
,
0 u a
a u b
b u L
=
s s
s s
s s
¦
´
¦
¹
¦

Fig. 6.3. Grey scale clipping











Fig. 6.4 Image thresholding


V









U
a b
V
U

Digital image processing Chapter 6. Image enhancement
Original histogram
Processed
histogram

Fig. 6.5 Image thresholding - example

The inverse image (negative image):
v = L-u (6.3)












Fig. 6.6 Image inverting Fig. 6.7 Grey scale slicing (windowing)
v v v
L
L L
L U a b U a b U
Digital image processing Chapter 6. Image enhancement

GREY SCALE SLICING (WINDOWING):


(6.4)

or
(6.5)


BIT EXTRACTION:

u=k
1
2
B-1
+k
2
2
B-2
+...+k
B-1
2+k
B
(6.6)


(6.7)


CONTRAST COMPRESSION:

v = clog(1+|u|) (6.8)

¹
´
¦
s s
=
otherwise
b u a
,
,
0
L
v
¹
´
¦
s s
=
otherwise
b u a
,
,
u
L
v
¹
´
¦
=
=
otherwise
1 k if
,
,
0
L
v
n
Digital image processing Chapter 6. Image enhancement
CONTRAST COMPRESSION – EXAMPLE:
v = clog(1+|u|)
IMAGE SUBTRACTION:
_
Digital image processing Chapter 6. Image enhancement



HISTOGRAM MODELING. HISTOGRAM EQUALIZATION/MODIFICATION

Def. Linear grey level histogram of a digital grey scale image U[M×N]:
= the function H
lin,U
:{0,1,…,L
Max
}→{0,1,…,MN},

H
lin,U
(u)=nbr. of pixels with grey level u from U.

Def. Normalized linear grey level histogram of the image U[M×N]:
= the function h
lin,U
:{0,1,…,L
Max
}→[0;1],

h
lin,U
(u)=H
lin,U
(u)/(MN).

Def. Cumulative grey level histogram of a digital grey scale image U[M×N]:
= the function H
cum,U
:{0,1,…,L
Max
}→{0,1,…,MN},


Def. Normalized cumulative grey level histogram of the image U[M×N]:
= the function h
cum,U
:{0,1,…,L
Max
}→[0;1],

h
cum,U
(u)=H
cum,U
(u)/(MN).











u
H
lin,U
(u)
H
lin,V
(v)
v
Ideally –
histogram equalization
. ) ( ) (
0
, ,
¿ =
=
u
l
U lin U cum
l H u H
( ) }. ,..., 1 , 0 { , ) (
) (
0
,
0
,
Max
u
l
U lin
u
l
U lin
on Equalizati
L u l H
MN
L
MN
l H
L u f v e ¬ ¿ = ¿ = =
= =




u V v
`

p
u
(x
i
)

p x
u i
x
u
i
( )
¿


Uniform
quantizer
Fig. 6.8. Histogram equalization


a b
Fig. 6.9 Low contrast image



a b
Fig. 6.10 The resulting image after histogram equalization


Digital image processing Chapter 6. Image enhancement





u v v'


Uniform
quantizer
f(u)

Fig. 6.11 Histogram modification




(6.15)



(6.15.a)





v = f(u) = p
x
i
x
=0
n
u
i
( )
¿
f(u) =
p
p
x
i
i
L-1
x
n
u
1
n
x =0
x
u
1
n
i
( )
, n = 2, 3,...
¿
¿
Digital image processing Chapter 6. Image enhancement
¿
A
M

SPATIAL OPERATIONS: most of them can be implemented by convolution




¿ ¿
=
e
l) - n k, - l)u(m a(k, n) v(m,
W l) (k,
Digital image processing Chapter 6. Image enhancement
( ) { } l k a L K , ] [ = × A - Convolution mask
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( ) (
(
(
¸
(

¸

÷
÷
÷ ÷ ÷ ÷
=
1 , 1 0 , 1 1 , 1
1 , 0 0 , 0 1 , 0
1 , 1 0 , 1 1 , 1
a a a
a a a
a a a
A
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( ) (
(
(
¸
(

¸

÷
÷
÷ ÷ ÷ ÷
=
1 , 1 0 , 1 1 , 1
1 , 0 0 , 0 1 , 0
1 , 1 0 , 1 1 , 1
'
a a a
a a a
a a a
A
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
M
a a a
a a a
a a a
A =
(
(
(
¸
(

¸

÷ ÷ ÷ ÷
÷
÷
1 , 1 0 , 1 1 , 1
1 , 0 0 , 0 1 , 0
1 , 1 0 , 1 1 , 1



v(m,n)=1/2[y(m,n)+1/4{y(m-1,n)+y(m+1,n)+y(m,n-1)+y(m,n+1)}] (6.20)










Fig. 6.12 Convolution windows used in low-pass spatial filtering - examples



Spatial averaging. Low-pass spatial filtering:

(6.18)

(6.19)

v(m,n) a(k,l)y(m- k,n - l)
(k,l) W
=
e
¿ ¿
) l - n k, - y(m
N
1
= n) v(m,
W l) (k,
¿ ¿
e
l
0 1

0
k
1

2x2 window
1/4 1/4
1/4 1/4

l
-1 0 1

-1
k
0

1

3x3 window
1/9
1/9 1/9 1/9
1/9
1/9 1/9
1/9
1/9







l
-1 0 1

-1
k
0

1

5 points weighted averaging
1/2
0 0 1/8
1/8
0 1/8
1/8
0





Filtering by spatial averaging – the effect on the noise power reduction:

(6.21)

(6.22)

v(m,n) = u(m,n) + (m,n) q
v(m,n) =
1
N
u(m- k,n - l)+ (m,n)
w (k,l) W e
¿
¿ q
Digital image processing Chapter 6. Image enhancement
Directional low-pass spatial filtering:

(6.23)












Fig. 6.13 Directional spatial filtering


v(m,n: =
1
N
y(m- k,n - l)
(k,l) W
u
u
u
)
e
¿ ¿
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
K
W
0
u
0
l

Median filtering:
(6.24)
 v(m,n) = the element in the middle of the brightness row, with increasing brightness values



} W l) (k, l), - n k, - {y(m median = n) v(m, e

a b
Fig. 6.14 Additive noise attenuation by mean filtering


Digital image processing Chapter 6. Image enhancement
v(m,n)=u(m,n)+ g(m,n) ì
g(m,n) = u(m,n) -
1
4
[u(m- 1,n)+u(m,n - 1)+u(m+1,n)+u(m,n+1)]











a b
Fig. 6.15 Gaussian noise reduction by median filtering

UNSHARP MASKING AND EDGE CRISPENING:





a b c d
Fig. 6.16 Edge crispening algorithm













Signal












Low pass
filtering






a-b





High pass
filtering
a+ìc
(6.25)
(6.26)
Digital image processing Chapter 6. Image enhancement



Original image Resulting image
Fig. 6.17 Edge crispening using a Laplacian operator

HIGH-PASS SPATIAL FILTERING

(6.27)



n) (m,
h
- n) (m, = n) (m,
h
TJ TS
o



Fig. 6.18 Low-pass filtering Fig. 6.19 High-pass filtering






u(m,n) v
TJ
(m,n)
Spatial averaging
(mean filtering)




u(m,n) + v
TS
(m,n)

_



Spatial Low-Pass
Filter
+
Digital image processing Chapter 6. Image enhancement






a b











c d
Fig. 6.21 The results of LPF (Fig. c), HPF (Fig. b),BPF (Fig. d) for a grey level image (Fig. a – original image)





u(m,n) + v
TB
(m,n)
_


FTJ
h
TJ1
(m,n)

FTJ
h
TJ2
(m,n)
+
Fig. 6.20 Band-pass image filtering
TB
TJ TJ
h
(m,n) =
h
(m,n) -
h
(m,n)
1 2
BAND-PASS SPATIAL FILTERING:
(6.28)
Digital image processing Chapter 6. Image enhancement
INVERSE CONTRAST RATIO MAPPING; STATISTICAL SCALING:

(6.29)


(6.30)


(6.31)


(6.32)

(6.33)

¸ =
o
µ
v(m,n) =
(m,n)
(m,n)
µ
o
µ(m,n) =
1
N
u(m- k,n - l)
W (k,l) W
¿
e
¿
} ] n) (m, - l) - n k, - [u(m
N
1
{ = n) (m,
1/2 2
W l) (k, W
µ ¿
¿
o
e
n) (m,
n) (m, u
= n) v(m,
o

MAGNIFICATION AND INTERPOLATION (IMAGE ZOOMING):
• Zooming by pixel replication:
(6.34)


The resulting image is obtained as:
(6.35)

with m,n =0, 1, 2,...

H
1 1
1 1
=
v(m,n) = u(k,l)
k = Int[
m
2
], l = Int[
n
2
]
Digital image processing Chapter 6. Image enhancement


a b c
Fig. 6.22 Image zooming by pixel replication by a factor of: b) 2; c) 4, on each direction
Zooming by linear interpolation:
(6.36)

(6.37)

(6.38)

(6.39)


(6.40)


i v
(m,2n) =u(m,n), o m M- 1, o n N - 1 s s s s
i v
(m,2n+1) =
[u(m,n)+u(m,n+1)]
2
, 0 m< M - 1 s
v(2m,n) = v (m,n)
i
v(2m+1,n) =
[
v
(m,n)+v (m+1,n)]
2
, 0 m M - 1, 0 n 2N - 1
i
i
s s s s
H
1 / 4 1 / 2 1 / 4
1 / 2 1 1 / 2
1 / 4 1 / 2 1 / 4
=









1 4 7 35
2 3 4 2
3 2 1 0 5
15 1 0 5 0 25
,
,
, , ,

¸

(
¸
(
(
(
(

Columns
interpolation
(
(
(
(
¸
(

¸

0 0 0 0
5 , 0 1 2 3
0 0 0 0
5 , 3 7 4 1

1 0 7 0
0 0 0 0
3 0 1 0
0 0 0 0

¸

(
¸
(
(
(
(

Rows
interpolation
1 7
3 1

¸

(
¸
(

Zeros
interlacing Fig. 6.23
Digital image processing Chapter 6. Image enhancement
6.6 TRANSFORM DOMAIN IMAGE PROCESSING







• Generalized linear filtering

(6.41)

where g(k,l) is called regional mask (i.e., it is 0 outside the selected region)



u(m,n) v(k,l) v’(k,l) u’(m,n)


Inverse transform

A
-1
V [A
T
]
Point-wise
operations
f(-)
Unitary transform

AUA
T

Fig. 6.24 Image enhancement in the transformed domain
v(k,l) g(k,l) = (k,l) v · '
a b
0 a b N-b N-a -1
K
c
d
N-d
N-c
N-1
FTJ FTJ
FTB
FTS
FTB
FTB FTB
FTJ FTJ
0 p q
K
r
s
FTJ
FTB
FTS
Fig. 6.25 Regional masks for the generalized linear filtering
Digital image processing Chapter 6. Image enhancement
E.g.: - the inverse Gaussian filter has the following regional mask:


(6.42)


- for other orthogonal transforms:

(6.43)


Non-linear filtering
(6.44)

(6.45)

¦
¹
¦
´
¦
÷ ÷
s s
+
otherwise l), N k, g(N
N/2 k,l 0 ,
2
l k
exp
= g(k,l)
2
2 2
o
g k l
k l
k l N ( , )
( )
, , =
+
s s ÷ exp
2
1
2 2
2
0
o
v(k,l)=|v(k,l)|
e
j (k,l) u
v (k,l) |v(k,l)| e 0 a 1
, a j (k,l)
= · s s
u

Generalized cepstrum and homomorphic filtering













s(k,l) = [log|v(k,l)| ]
e
, |v(k,l >0
j (k,l) u


u(m,n) v(k,l) s(k,l) c(m,n)



A
-1
S (A
T
)
-1
|Log,v(k,l),|e
je (k,l)

A U A
T

Digital image processing Chapter 6. Image enhancement


c’(m,n) s’(k,l) v’(k,l) u’(m,n)



A
-1
V (A
T
)
-1
|exp,s’(k,l),|e
je (k,l)

A C A
T

IMAGE PSEUDO-COLORING









Fig. 6.27 Monochrome image pseudo-coloring




u(m,n) v
2
(m,n) G c(m,n)



A
-1
S (A
T
)
-1



Color space
transformation


Feature
extraction
R
v
1
(m,n)
B
v
3
(m,n)
COLOR IMAGE ENHANCEMENT




























Fig. 6.28 Color image enhancement block diagram







R

G

B











Output
image
rendering


Inverse
color
space
transform


Monochrome image
enhancement algorithm

Color
space
transform

Input
image

Monochrome image
enhancement algorithm


Monochrome image
enhancement algorithm

Digital image processing Chapter 6. Image enhancement
BIOMEDICAL IMAGE ENHANCEMENT - APPLICATIONS

Biomedical image types & features
















Fig. 6.42 Fig. 6.43













Fig. 6.44 Fig. 6.45


Digital image processing Chapter 6. Image enhancement
Contour extraction in biomedical images:
Table 6.1



(6.76)






H
1 1 1
1 9 1
1 1 1
L
=
÷ ÷ ÷
÷ ÷
÷ ÷ ÷
Operator
a
11
a
12
a
13
a
21
a
22
a
23
a
31
a
32
a
33

Gradient directional E
Gradient directional NE
Gradient directional SW
Filtru trece-sus 1
Filtru trece-sus 2
Laplacian
Laplacian diagonal
Laplacian orizontal
Laplacian vertical
Prewitt orizontal
Prewitt vertical
Sobel orizontal
Sobel vertical
Kirsch orizontal
Kirsch vertical
1 1 1 1 -2 1 -1 -1 -1
1 1 1 1 -2 -1 1 -1 -1
1 1 -1 1 -2 -1 1 1 -1
0 -1 0 -1 5 -1 0 -1 0
0 -1 0 -1 4 -1 0 -1 0
-1 -1 -1 -1 9 -1 -1 -1 -1
-1 0 -1 0 4 0 -1 0 -1
0 -1 0 0 2 0 0 -1 0
0 0 0 -1 2 -1 0 0 0
-1 -1 -1 0 0 0 1 1 1
1 0 -1 1 0 -1 1 0 -1
1 2 1 0 0 0 -1 -2 -1
1 0 -1 2 0 -2 1 0 -1
-3 -3 5 -3 0 5 -3 -3 5
5 5 5 -3 0 -3 -3 -3 -3


Fig. 6.46 Fig. 6.47

Digital image processing Chapter 6. Image enhancement

Histogram equalization and pseudo-coloring in biomedical images:














a b
Fig. 6.48
































Fig. 6.49 Fig. 6.50

Digital image processing Chapter 6. Image enhancement











Fig. 6.51 Fig. 6.52

















Fig. 6.53 Fig. 6.54



Digital image processing Chapter 6. Image enhancement