Chapter 3 Intensity Transformations and Spatial Filtering
Chapter 3 Intensity Transformations and Spatial Filtering
3.1 Background
g ( x, y ) = T [ f ( x, y )] (3.1-1)
where f(x, y) is the input image, g(x, y) is the output image, and T
is an operator on f defined over a neighbourhood of point (x, y).
The operator can apply to a single image or to a set of images.
GACS-7205-001 Digital Image Processing Page 78
(Fall Term, 2018-19)
Example:
GACS-7205-001 Digital Image Processing Page 80
(Fall Term, 2018-19)
Image Negatives
Example:
Log Transformations
Example:
s = cr γ (3.2-3)
where c and γ are positive constants.
Example:
Contrast stretching
Example:
GACS-7205-001 Digital Image Processing Page 88
(Fall Term, 2018-19)
Intensity-level slicing
One approach is to display in one value all the values in the range
of interest and in another all other intensities, as shown in Figure
3.11 (a).
Bit-plane slicing
Example:
GACS-7205-001 Digital Image Processing Page 91
(Fall Term, 2018-19)
Example:
GACS-7205-001 Digital Image Processing Page 92
(Fall Term, 2018-19)
Example:
Histogram Equalization
(b) 0 ≤ T (r ) ≤ L − 1 for 0 ≤ r ≤ L − 1 .
r = T −1 ( s) 0 ≤ s ≤ L − 1 (3.3-2)
in which case we change condition (a) to
(a ') T (r ) is a strictly monotonically increasing function in
the interval 0 ≤ r ≤ L − 1 .
Figure 3.17 (a) shows a function that satisfies conditions (a) and
(b).
GACS-7205-001 Digital Image Processing Page 95
(Fall Term, 2018-19)
From Figure 3.17 (a), we can see that it is possible for multiple
values to map to a single value and still satisfy these two
conditions, (a) and (b). That is, a monotonic transformation
function can perform a one-to-one or many-to-one mapping,
which is perfectly fine when mapping from r to s.
dr
ps ( s) = pr (r) (3.3-3)
ds
A transformation function of particular importance in image
processing has the form
r
s = T (r) = ( L − 1) ∫ pr (ω )dω (3.3-4)
0
Using (3.3-3) and recalling the Leibniz’s rule that saying the
derivative of a definite integral with respect to its upper limit is
the integrand evaluated at the limit, we have
ds dT (r )
=
dr dr
d r
= ( L − 1) ∫ pr (ω )dω
dr 0 (3.3-5)
= ( L − 1) pr (r )
dr
ps ( s) = pr (r )
ds
1
= pr (r )
( L − 1) pr (r )
(3.3-6)
1
= 0 ≤ s ≤ L −1
L −1
which shows the that ps ( s) always is uniform, independently of
the form of pr (r ) .
2r
for 0 ≤ r ≤ L − 1
pr (r ) = ( L − 1)
2
0
otherwise
GACS-7205-001 Digital Image Processing Page 98
(Fall Term, 2018-19)
From (3.3-4),
r
s = T (r ) = ( L − 1) ∫ pr (ω )dω (3.3-4)
0
r
2 r2
ω dω =
( L − 1) ∫0
=
L −1
We can versify that the PDF of the intensities in the new image
is uniform by substituting pr (r ) into (3.3-6) and using the facts
that s = r / ( L − 1) , r is nonnegative, and L > 1 :
2
dr
ps ( s) = pr (r ) (3.3-6)
ds
−1
2r ds
=
( L − 1)2 dr
−1
2r d r2
= dr L − 1
( L − 1) 2
2r ( L − 1) 1
= =
( L − 1)2 2r L −1
GACS-7205-001 Digital Image Processing Page 99
(Fall Term, 2018-19)
( L − 1) k
∑ nj
(3.3-8)
= k = 0,1, 2,..., L − 1
MN j =0
1
s1 = T (r1 ) = 7∑ pr (rj ) = 7 pr (r0 ) + 7 pr (r1 ) = 3.08 ,
j =0
The left column in Figure 3.20 shows the four images from
Figure 3.16.