Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

module-3

Uploaded by

Protocol
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

module-3

Uploaded by

Protocol
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

REVIEW QUESTIONS ag

transforms for an image.


twodimensional orthogonal
1. Give
transforms.
separable unitary
2. Define
3. Howbasisimages
can be obtained for
the set of transforms. CHAPTER-3
products and Dimensionality.
4. Describe kronecker IMAGE ENHANCEMENT
of Unitary Transforms.
5. Give the properties
Two-dimensional DFT.
6. Define the
two-Dimensional DFT.
7. Give the properties of the
theorem.
8. Explain Two-dimensional circular convolution mage Enhancement in Spatial Domain
9. Define discrete cosine transform (DCT). Image Enhancement refers to emphasize image features such as edges, boundaries, or increase
10. Give the properties of DCT. :ontrast to make graphic display more useful for display and analysis.
11. Define Sine Transform.
3.1 Background
12. Give the properties of the sine transform.
The term spatial domain refers to the aggregate of pixels composing an image. Spatial domain
13. Define Handamard Transform. nethods are procedures that operate directly on these pixels. Spatial-domain processes will be
14. Give the properties of Hadamard Transform. denoted by
8 (x y) = TðW y)) ---- (3.1)
15. Define HAAR Transform.
wheref(x, y) is the input image.
16. Give the properties of HAAR g y) is the output image.
Transform.
17. Define slant Transform. Tis the operator on for gray level transformation function
18. Give the properties of slant Origin
19. Define the KL
Transform.
transform for images.
20. Give the
properties of the KL transform.

Image f(, y)

point in an image
Fig. 3.1 :A3x3 neighborhood about a(x, y)
77

76
\mage Py Image Enhancement
Transformation
Pointprocessing imagedepends
only on the
gray level at 3.2 Some Basic Gray level
in an that. Ol3.2.1 |Image Negatives
Enhancement atany valueoffat(uy)and Tbbecomes agray-level
point

case, gdepends
the fornms=
onlyonthe
T(r)
leveloff(: y),
4,y).
s-graylevel
ofg transtormal luns
transformation.
The negative of an image with gray levels in the range
S = L-|-r
[0, L- 1] is obtained by using negative
---- (3.2)
Point r-gray isnot often used becauseit does not give more flexibility, The more %
Whereprocessing white or gray detailembedded in
in Fig. 31 This processing isparticularly suited for enhancing dominant
3x3 as shown 3 x3 This type of in size. Fig. 3.3(a) is a
neighborhood i.e.,coefficients areas are
determine the nature neighbg of an image especially when the black
larger
methodis using kernel. The mask of process hdark regions the negative of the image in Fig. 3.3 (a). Fractured bone is
called mark, filter or sharpening etc., Contrast stretching. lOr in image of fractured bone. Fig. 3.3(b) is
smoothing(Blurring),
transformation log-transformation,
and histogram processing are point processing methods for image enhanc POWe more clearly visible in negativeimage
Fig. 3.3(b) than in Fig. 3.3 (a).

Contrast stretching
Low contrast image occur due to poor lighting conditions or due to small dynamic va,
image sensors.
image sensOrs, non linearity of
which makes the e object distinguishablep
Contrast is the difference in visual properties
background. (b) Negative Image
(a) Original Inage
Increasing contrast means increasing the gray level difference between neighbor nivd. Fig. 3.3 : Example of image negatives
has the form shown in Fig. 3.2(a), where r is the input image gray levels, s is the pre
(output) image gray levels. The effect of this transformation would be to produce an iny L-1
highercontrastthan the original by i.e., thresholding the levels below mand brightening the:
above min the original image.ln the limiting case T(r) as shown in Fig. 3.2 (b) prodcsi Negative
level image (binary image).
nth root
s=Tr) s=T(r) 3LI4
slevel,
Light
Light log
gray nth power
+ OutputL/2
Tr)
Dart

Dart

L/4

Inverse log
Dart Identity
+Light
(a) Dart Light
Fig. 3.2 : Grey (b)
0
3L/4 L-1
level L/4 LI2

transformation functions for a Contrast enhancemen! Input gray level, r


functions used for image enhancement
Fig. 3.4 : Some basic grey level transformation
78

3.2.2 Log Transformations Image Proy Image Enhancement 79

The general form of the log transformation is


Power - law transformations have the basic form
S = clog(l +r) S = cr ---- (3.4)
Where cis aconstant and it is assumed that r20
Where c and y are positive constants. Power law curves with fractional values of ymap a
The shape of the log curve is as shown in Fig. 3.4shows that this narrow range of dark input into a wider range of output values, with the opposite being true for
narrow range of low gray level values in the input image into a
upposite is true for higher values of input levels (wider range of wider range of output level
high input gray
transformalion
n. higher values of input levels shown in the Fig. 3.5. The curves generated with values ofy>1
have exactly the opposite effect at those generated with values of y<1. Whenc=y= l the above
cquation reduces to the identity transformation. A variety of devices used for image capture. printing
transformationlevels
level) : mapped to narrow range of output levels). The usc of (lighy,
expandthe values of dark pixels in an image while O this t anddisplay respond according toa power law (gamma y). The process used to correct this power
opposite is true for the inverse log transformation. compressing the higher gray level value -law response phenomena is called gamma correction.
3.2.3 Power Law Cathode Ray Tube (CRT) devices have an intensity to voltage response that is a power function
Transformations y= 2.5 as shown in Fig. 3.6. Such displays systems wouldtend to produce images that are darker
1
than intended. So to avoid this preprocess the input image with y= =0.4 before inputting it
L-| 2.5
into the monitor.
Y=0.04
Linear wedge grey scale image Image viewed on moritor
Y=0.10
3LJ4
s
Y=0.20
level,
Y=0.40 C Monitor
gray
Output Y=0.67
Y=1
Y= 1.5

Y=2.5 Gamma
U4 cOrrection
Image viewed on moritor
Y=5.0
Y= 10.0
Y= 25.0 D Monitor
U4
64 3L/4
125 190
L-1
Fig. 3.5 : Plot of Input gray level, r 255
the power law
transformations forthe various values of"'' with he=lin all cases Gamma corrected image

Fig. 3.6: Example for gamma corrections


80
Image Proce
8
Image Enhancement

Fig. 3.8 (a) is the original washedout light image of' a man under a bridgc. Fig. 3.8 (b) is the
result of power-lawtranslormation with c= Iand gamma =4. Fig. 3.8 (c) and Fig. 3.8 (d) are the
result of power law transformation with c= Iand gamma =5 and 6 respectively. Note that as
gamma increased from 4 to 6 more details became visible because contrast has increased.

3.2.4 Piecewise - linear Transformation Functions


(a) Original image (fossil) (b) Result of power law iranslormatig, Contrast stretching: Low contrast images can result from poor illumination. lack of dynamic
with c= land y=0.6 range in the image sensor or even wrong setting of a lens aperture during image acquisition. The
idea behind contrast stretching is to increase the dynamic range of the gray levels in the image
being processed. Fig. 3.9(a) shows atypical transformation used for contrast stretching. The locations
of points (r, s) and (r, s,), control the shape of the transformations function. If r, =s, and r, =s,,
the transformation is a identity transformation, produces no changes in gray levels. Ifr,=r, and s,
=0 and s, =L-1, the transformation becomes a thresholding function that creates a binary image
(two gray levels 0 and 1). In generalr,sr, and s,Ss, so that function is single valued and
monotonically increasing. The input image gray levels between r, and r, willhave a good sketch
between s, and s, in theoutput image gray levels.
(c) Result of power law transformation (d) Result of power law transformation
with c= l and y= 0.4 L-Ip
with c=1 and y=0.5
Fig. 3.7: Erample of powerlaw transformations s
level,
r,, s,)
3L/4
Fig. 3.7 (a) is the original dark image of fossil. Fig. 3.7 (b) is the result of power
transformation with c=1l and gamma=0.6. Fig. 3.7(c) and Fig. 3.7 (d) are the result of powert gray
transformation with c=land gamma = 0.5 and 0.4 respectively. Note that as gamma decrea Tr)
from 0.6 to 0.4 more details became visible. OutputLI2

LI4

(r,s)

LI4 3LJ4 L-1


Input gray level, r
(a)
(a) Original image (b) Result of power law transformation
with c=land y= 4

(c) Result of power law (c) (d)


C=l and transformation with (b
y=5 (d) Result of power law
transformatio Fig. 3.9 : Aform of contrast stretching transformation function
Fig. 3.8 : Power law with c= l and y=6
transformation with y >1
82
Image PrOCe; Image Enhancement
83

contrast. Fig. 3.9 (c) shown an


Fig. 3.9 (b) shows in 8
bit image with low image
ob
s,) = (r L- 1). Here r and rr maiority of the visually significant data. Separating a digital image into its bít planes is useful for
(r,,s)=(Cn 0) and (r, respectively.
contrast streching by keeping
from gray levels of the input image
S, =0 and Lanalysing the relative importance played by each bit in the image. Using this approach one can
the minimum and maximum (L- ) gray levels of the output image. So the understand the minimum number of bits required to represent the image with desired details.
The
the mininmum (0) and maximum
levelsrmin.to Oandr .to L-1 linearly. transtormg
So the dynamic ano number of bits required to represent a pixel plays in important role, as it decides the size of the data
function stretched the input gray required to represent and store the image.
increased.
the input image has
function withr, =r,=m, the me
Fig, 3.9 (d) is the resultthresholding transformation One 8-bit byte Bit-plane7
which has only two gray levels (o (most significant)
level in the image Fig. 3.9 (d) is the binary image
respresented by a single bit.
3.2.5 Gray - Level Slicing
Gray levelslicing is used to highlight aspecific range of gray levels in an image. Applieog. Bit-plane 0
include enhancing features such as masses of water in satellite imagery and enhancing flawe: (least significant)
ray images. One approach is to display a high value for all gray levels in the range of intere
a low value for all other gray levels. The second approach, brightens the desired range of e
levels but preseves the background.
Bitplane representation of an 8 bit image
L-1 Fig. 3.11: Bits shown as planes

S T(r)

a)Original image b) Image bit plane 7 c) Image bit plane 6

A
L-1 A B L-1
(a) This transformation highlights range
(b) This transformation highlights range
(A, B]of gray levels and reduces all
others to a constant level. A, B]but preserves all other levels.
Fig. 3.10 : Gray level slicing
The transformation shown in Fig. 3.10 (a) transfor1nations
Fig. 3.10 (b) brightens the desired range of gray produces abinary image with only two gray d) Image bit plane 5 e) Image bit plane 4
) Image bit plane 3

tonalities in the level and preserves the background and gray


image.
3.2.6 Bit plane slicing
Bit plane slicing is
bits might be desired. highlighting the contribution made to total
image appearance by
image is composed ofSuppose that each pixel in an image is
represented
eight one-bit planes, ranging bit plane 0 for by 8 bits. Imagine
significant bit as shown in from
bit plane 7 for the most the least significa
Fig. 3.11. The higher order bits cont e) Image bit plane 1 ) Image bit
plane 0
d) Image bit plane 2
planes shown on an inage
Fie. 3.12: Importance of bits
Image Proces 85
84 Image Enhancement
(i)
seeds. Fig. 3.12 (b) to shows the variO
image of a sunflower order. From this we can
Fig. 3.12 (a) shows the
plane 7to lower bit
plane Oin the
planes from higher bit majority of the visually significant data. The
observe th¡
other bit planes
higher order bits have contribu
more finer details in the image.
3.3 Histogram Processing (a)
discrete ..
gray levels in the range (0, L - 1] is a
The histogram of adigital image with the number of pixelsin the image havine
and n, is
h(r) =n, wherer, is the kih gray level P r)= nn where k=0,1...., L- 1. and n is
normalised histogram is given by
r,. À estimate of the probability of occurarance of
number of pixels in the image. Po) gives an
level r level values r,. The ver
The horizontal axis of each histogram plot corresponds to gray
is number pixels in the in
axis coresponds to values of h(r)=n, orp (r)=n/n, wherethen,dark image, the componen
having gray level r, n= total number of pixels in the image. In Similarly, the comnom (b)
the histogram are concentrated on the low (dark) side of the gray scale.
of the histogram of the bright image are biased towards the high side of the gray scale. An in
with low contrast has a histogram that willbe narrow and will be centered toward the middle of
gray scale. The components of the histogram in the high-contrast image cover a broad range of
gray scale.
Fig. 3.13 is a baby image shown in four basic gray level characteristics; ark, ligh.
contrast and high contrast with their respective histograms. Fig. 3.13 (a) is a dark image
histogram whose components are concentracted on the low (dark) side of the gray scale. Fig.
(b) shows the light image with histogram in which components are concentrated on the high (li;
side of the gray scale. Fig. 3.13 (c) shows the low contrast image with histogram where compon: (c)
are narrow and concentrated in the middle of the gray scale. Fig. 3.13 (d) shows the high cont
image with histogram whose components are distributed over a broad range of the gray scale.
high contrast image will have large variety of gray tones.

(d)

bright, (c) low constrast, (d) high constrast and


Fig. 3.13 : Four basic type of images : (a) dark, (b)
respective image histograms
S6 Image PrOCe 87
Image Enhancement
3.3.1 Histogram Equalization
image to be enhanced.
represent the gray levels of the The Atranformation function of particular importance in the image processing has the form.
the range [0 tovariable
Let the (L-1)],r r=0 variabler
represents black pixel and r=L-lrepresnets white pixel. Con
---- (3.8)
the transformation of the form s= T)=L-1[p. (w)dw
S= T() 0srsL-1 Where wis a dummy variable of integration. The right side is recognised as the CDF
(Cumulative
pixel value rin tthe originalimage. Distribution Function) of random variable r. This transformation is single valued and monotonically
That produces a output intensity levels for every density function
Assume that the transformation function T() as shoWn in Fig. 3.14 satisfies the fol, increasing and therefore satisfies condition (a). Similarly the integral of aprobability
condition (b) is satisfied.
for variables in the range [0, 1] also is in range [0, 1]. So
conditions.
a) T(r) is single - valued and monotonically increasing in the interval 0Sr<L- J: and ds dT(r)
b) 0<T(r) s L-1for 0SrsL-1 dr dr
--.- (3.9)
From requirement (a) It is guaranteed that the inverse transformation T(s) exists. The iny = (L- 1) p)
transformation from Sback to r is denoted by Substituting this result for ds / dr =p(r) into equation (3.7). P(S)
r= T-(s) 0<ssL-1 A
|dr
P,() = p(r)
ds

1 |(L-)p, () L-1

---- (3.1O)
p.(0) =-, 0sssL-I
Asp,(9) =-|: we recongnize p. (s) as a uniform probability density function.
equation (3.10) resultingp.(s) is
From equation (3.8) T() depends onp.(r) but as indicated by
T(r) always uniform independent of the form ofp().
instead of probability density
For discrete values we deal with probabilities and summations approximated
r, in an image is
function and integrals. The probability of occurrence of gray level
by
---- (3.11)
P.) = k = 0, 1, 2, .......L-1

the number of pixels that have gray


Where n is the total number of pixels in the image, n, isdiscrete version ofthe transformation
possible gray levels. The
L-1
levelr, and Lis the total number of
function is given by
Fig. 3.14:A grey level
Note : Random variables (And transformation
PDF) are explained in detail in
function S, = Tr) = (L- 1 J=0
The gray levels in an Appendix II.
P() and p(s) denote the image may be assumed as
P,) and T(r) are probability randam variables
density functions of random in ther intervalI[0, L-1].
known and T-'(s) satisfied variables and s respecuv (y Snj, k=0.1,2....L -1, where p, (r) = n

condition (a), then the p(s) can be obtained by


s, =
n J=0

p(s) =Pír) drl


8. = Tr) =(L-1)J=0 k=0, I, 2,...L-1 --- (3.12)
Jds
89
Image Procp: Image Enhancement

The processedimage is obtained by mapping cach pixel with level r, in the input imageim of applying
Fig. 3.15 shows the four images from Fig. 3.13. Fig. 3.15 (b) shows the result low contrast
plot of p.(r) versus r, is called cach of these images. The dark image, light image and
image. A Istogh histogram equalization on
corresponding pixel with level s, inthe output (3.12) is called histogram equalization. image after undergoing histogram cqualization has a
significant improvement. The fourth image
The transformation(mapping) given by equation probability The dsg donot have a significant improvement. Fig. 3.15 (c) shows
the
transformation will produce the discrete
equivalent of a uniform density fung which is a high contrast image
(a). The histogram of
resnective histogram equalization transformation for the images in Fig. 3.I5 that,
which would be a uniform histogram. the equilized images are shown in Fig. 3.15 (c). It is
interesting to observe even though the
bistogranm are different, the histogram equilized images are visually simillar.
Example for historgram equilization
Problem 1

4 Perform image histogram equilazation for the image shown in fig. 3.16
[0 0 0 1 1]

2 2 2 23
33 3 3 3
|0 0 0 7 7|
Fig. 3.16

Solution:
with size 5 x5
Considera hypotetical image shown in the fig. 3.16
given image is 7. So 3 bits are required to represent
The maximum value of the pixel in the 8
number of possible gray levels in the image is
each value of the value. Therefore the
(0 to 7).
be drawn as shown in the figure.
The histogram of the given image can

Plr)
1

8
7
6
5
4
0.28
3 0.24
0.24
0.16
2 0.08

.1 7
4 5 6
1 2 3
(a) (b)
(C) (d)
Fig. 3.15: Example of image
kistogram equilization transformation
90 Image PrOCk Enhancement 91
Image
Calculations to draw histogram

for "%=Pra) AP,(S,) S,

6 6/25 =0.24
6
7 7/25=0.28
7 5
4/25 =0.16 6
4 4
5
.28 3
6 6/25 =0.24 .24 .24
16 2
4 0 0/25 = 0 .08

5 O/25=0 6 7
1 2 3 4 5 1 2
6 O/25 =0
The histogram of the histogram The transformation function is given by
7 2 2/25 =0.08 equalized image is
The histogram equalized image can be calculated as follows. The new gray levels of s, = Tr)=(L-) p.;), k=0, 1,2...-1
J=)

histogramequalized image is given by s, =TC) =(L-1) Xp.r). k= 0, 1, 2.... .-I


J=0
Problem 2
If the original probability density function of an image is as shown in fig. 3.18. Find the
P,(r) transformation function needed for histogram equalization.
for
k
J=0 S, =(L-1) Xp.,)
J=0
4P,\r)
6/25 =0.24 0.24
0.24 ×7= 1.68 = 2 2*P
7/25=0.28 0.24 +0.28 =0.52 0.52 ×7=3.64 = 4
2 4/25 =0.16 1+
0.52 +0.16= 0.68 0.68 ×7=4.76 =5
6/25 =0.24
4 O/25 = 0
0.68+0.24 =0.92 0.92 x7=6.44 = 6 1 2
0.92 +0 =0.92
0.92 x7 =6.44 = 6 Fig. 3.17
O/25 =0
0.92 +0 =0.92 Solution: Histogram equalized image will have the following probability density function.
0/25 =0 0.92 x7=644 6
0.92 +0 =0.92
2/25 =0.08 0.92 x7=6.44 6
0.92 +0.08 = 1 4P,(s)
To get a
histogram equalized image. Ix7=7 1
Replace Oby 2.
1by 4
2by 5 the new image matrix is
3by 6 [2 2 2 4 4
4by 6 4 4 4 4
4
5by 6 Fig. 3.18
5 5 5 5
6by 6 6
7by 7 6 6 6 6
6
|2 2 2 7 7|
92 Image ProC Image Enhancement
93

From the given pdf graph in fig. 3.17


joining PPand Qis given by
let P(0,2)and Q(1, 0) be two pointsthe straight line PQ=
-2r +2 0srsl ds
So. P() = 0 else where
Consider the transformation function -(2+2/1-i*2}l-(:--)
0sSsI
s= T0)-[P("»)de which is a uniform density in the desired level. The transformation function
T(r) is shown in
where wis adummy variable of Integration. The right most side of above equation is recoon: the following figure.
as the cumulative distribution function (CDF) of r.
4T(r)=s
s=T)=[-w+ 2)dw 1

s=-r-2r
0.8
then r = 1t/|
For histogram equalization T(r) is only 0.6
the output image is uniform.
needed, but it is necessary to show that resulting Ddi
0.4
The derivative of S with respect to r is
given by 0.2
ds
0.2 0.4 0.6 0.8
dr
The inverse transformation from sback to r will be denoted by r=T(s), 0< Fig. 3.17
where it is assumed that T'(s) also ssl
3.3.2 Histogram Matching
monotonically increasing in the interval 0<rs1satisfies condition (a) T(r) is a single valued a In histogram matching, the shape of the histogram that we wish the processed image to have
(b) 0<T()slfor 0s rsi is specified.
condition (a) preserves the order from black to The method used to generate a processed image that has a specified histogram is called
(b) guarantees amapping that is consistant with the white in the gray scale, while conditi histogram matching.
interval [0, I] only the solution. r allowed range of pixel values, since r lies in tb
The probability density
=T-(s) =1-J1-s is valid. Development of the meio
following equation. function of S is obtained by Consider a image with input gray levels r and its shape of the histogram is specified with gray
substituting the above results into levels z.
Let r andz are continuous random variable, where r and z are the gray levels of the input and
Ouput (processed) images respectively. Let p(r) and p.() are probability density functions of r
respectively. p(r) can be estimated from the given input image. P,(2) can be obtained from
and z output image
ne specified histogramp (:) is the specified probability density function that we wish
to have. Let s be a random variable with the property.

s= T) = (L-1)p, (w)dw ---- (3.13)


94
\mage PrOCg Image Enhancement 95

of integration
Where wis a dummy variable Equation (3.17) a mapping from the levels in the original image into corresponding levelss
let random variable S, has property function
based on the histogram of the original image. Equation (3.18) computes a transformation
equation (3.19) gives us the discrete gray levels of the
S,= G) =(L- I) p.()dt =s s Gfrom the given histogram p.(z). Finally
image with that histogram.
Where t isadummyvariable of integration Implementation
equations that
It then follows from these two dimensional
G(z) = T() = s Each set of gray levels {r), {s,) and (z),j=0, 1, 2, ......- 1, is a one -
lookups between a
condition arrav of dimensionLx1. All mappings from rto sfrom s toz are simple table
..must satisfy the arrays as shown in the Fig. 3.18. Each of the elements of these arrays,
z= G()= G' [T)) oiven pixel value and these the location
subscript k denotes
for example, s, contains two important pieces of information. The
The transfornation T(r) can be obtained from p(r) of the input image. The transtormahe elementin the array and sdenotes the value at that location. We need to be concermed only
function G() can be obtained because p(2) is given. Assuming that G exists and that it stiwith integer pixel values. Forexample in the 8bit image L= 256, range is Oto 255. The procedure
condition (a) and (b). Equation (3.13) to equation (3.16) show that an image with a sperit or histogram matching may be summrised as follows:
probability density function can be obtained from an input image by using the following procet. 1. Obtain the histogram of the given image.
r,.
1. Obtain the tranformation function T(r) using equation (3.13). 2. Use equation (3.17) to precompute a mapped level s, for each level
2. Use equation (3.14) to obtain the transformation function Giz). 3. Obtain the transformation function G from the given P.(z) using equation (3.18).
3. Obtain the inverse tranformation function G-!. s, using the iterative scheme.
4. Precompute z, for each value of
is r,, map this value to its
4. Obtain the output image by applying equation (3.16) to all the pixels in the input image. 5. For each pixel in the original image, if the value of that pixel
The result of this procedure will be an image whose gray levels z
have the specified corresponding level s then map level s, into the final z,.
P.().
For Discrete values
The discrete formulation of
equation (3.13) is given by -Gz)
T)
--- (3.
j=0 (b)
(a)
L-1
n
(2-) ik=0.I. 2,3, ...L-l (a)
0
(b)
j=0 MN j=0
When nis the number of pixels in
and Lis the numbertotal the image. n, is the
of discrete gray
levels. number of pixel with gray 1
Similarly the discrete
p.(2), i=0, 1,..., L- lformulation of
and has the formequation (3.14) is obtained from the given
histog"
(c)
V, =G(z) =
The discrete k = 0, 1, 2,
(L-1))P.(,) j=0
=s, 0
0
(c)
version of equation (3.16) is ...
., L-]
from r, to s, via T(r). (b) Mapping of z, to
its corresponding value
given by () Graphical interpretation of mapping mapping from s, to its corresponding value of z,.
from equation (3.17) <,= G[Tr)) k= 0, v, via G(z), (c) Inverse
Zy= G(s) k=0, 1, 1,2, 2, ..... -] --o3.19
Fig. 3.18 : Graplhical
representation of histogrammatching
...., L- 1
96
that Fig.
istogram 3.19
Fig.
(b) 3.19 2000 4000 6000 8000 10000 12000 14000r
ization the is (a) 0
Fig.
Fig.
histogram is
the 3.20 50
3.19: (a)
image :
is Example 100 Example
the of (C)
good the of I50
Sunflower
image image image
oach 200
in an and
Fig. seeds its 250
its
to istogram
ce 3.19 histogram
(a). which 2000 4000 6000 8000 1000
for 128 192 1200; 1400
the At is 64+ for
thkistogranm
e has
e.
first histogram 50
more
64
nce,matching Trasnformation
100
dark
it (b) 128 function matching (b)
200150250
isonepixels

192 Image
ProC.
might by
conclu' t intastU
ofthe
Fig. histogram. original transofrm of moved TheEnhancement Image
3.19 the
inverse mor e histogram Fig.
Fig.
Number of pixels X> matched Sampling histogram, 3.21darker towards 3.20
Output gray levels
O 5.25+ o 3.50 5.25 (a)
7.00f transformation function
1.75: and The
1.75 3.50 7.00
transformationG this (apixels.
) of (a)
Histogram image. the
function butshows shown upper shows he
64 has image
Input
levels
gray 64 Observe the the
function into a inone
Fig. 128 equalized smoother manually Fig. histogram as
128192255 hal f also
3.21 that
are is
(2) 256 3.20
192255 shown
: immatched
age obtained asequally transitionspecified (b) thequalized
e
of
Result shown low gray in
2 in spaced gray the
of Figimage
. in by function of scale. Figimage
Histogram 3.20(a). applying
Fig. discrete levels levels .
is3.21 This 3.20which
1000 I500: 2000 2500 visually (c). inthat are
matclhing 0
500
tvalues
he the mapped is(c).
Fig.
histogram preserves
dark because, Notc has
50 better produced a
3.21 region light,
100 to how
than (d) the hiobserve gh washed
150 equalization
shows generalof all
the th e the gray the
200 input the desired gray levels
the gray out
250 shape equalization appearance.
Histogram
image specified and scale. levels
because
G(s) of
in the are
image Solution: 3.22(6).fig. 98
" ProblemExampl
3e
Perform The Consider
following calculated
is Perform
|I1 2 |2 3
histogram the 3.22(a)
Fig. 1 2 2 2
for
5
11
2 2 2 Histogram histogram
procedure and x5 1-
equilization 2 2 7 77 2
plot
hypothentical
2 2 7 71
has 3 4 5 64 7
fig.
in matching
for be
to
0.24
P,(S|)
3.22(c). matching
followed
the
1
image for
given 2
0.52 an
The image
0.04 as
to
image. 3.22(c) 3 desiredshown .2 3 4 .5.6 .74 .84 .9 14
perform Fig. PIZ) shown
4
0.1
histogram in
histogram 5 fig. 0,2 in
3.22(a). 3.22(b)
Fig. fig.
6
0.3
0.2 shown
is 3.22(a)
matching. The 0.1
0.1 histogram to
histogram in the
fig. 0.1
Irmage
Pr
3.22(b). 0,1
of
the
for
Enhancement
Image
"
forZ, Perform The
7 6 4 2 1 0
6 5 4 3 2 0
histogram
histogram
5/25 O/25=0O/25=0O/25=0
=0.2 =0.04
1/25 =0.52 6/25 0/25=0
13/25 =0.24
equivalization
0.1 0.1 0.1 0.1 0.3 0.2 0.1 (2)P, 1 2 3 4 54 6 equilization
7
S
1

transformation
for
J=0
the 10.80 0.80 0.80 0.80 0.76 0.24 0
3
1 0.9 0.8 0.7 0.6 0.3 0.1 0
given J=0

4 +
desiredfunction
5

6
given is
given
histogram.
by
x7=77 0.8 0.3 0.1 1
x7=0.7 Ix7=7 70.80 0.76 0.24
0.80 0.80 0.80 0x7=0=0
x7=
0.9 0.7x7= 4.9 5
x 0.6x7=4.2 4 0x7=0 0
x x x x x x
7=5.6 x
7 7=2.1 7 7=7=5.32
= = 7= 7=
6.3 5.6 5.6 J=0
5.6 5.6 1.68
s6 = s
6 2 6 6 6 6 5 =2

99
100
by
\mage Pr Image Enhancement 101
function is given
Equalization Transformation
The resultant histogram after histogram matching is given by.
P(z,)

0.52
5
4
3
2.4 0.2
.24 0.04
0.1
2 3 4 5
Problem 4

" Perform matching An image has the gray level pdf p(r) shown in fig a. It is desired to transform the gray levels
of this so that they will have the specified p(z) shown in Fig. b. Assume continuous quantities and
given image desired histogram find the transformation in terms of r and zthat will accomplish this.
finally r, ’ 4Pr) 4 P(r)
Equalization Transformation function is given by
2
Given image Desired histogram Finally
S 1

0
Sk
0
| -

2 1 2
2
Fig. 3.23
-5 -2 2 4
Solution:
3 6 4 3 3 We know that
4
4 4 5 ---- (1)
5 6 s = T) - [p.(*) dv
5
6 6 6 where w is a dummy variable of integration
6
6 5
77 -7. 7 7
using straight line equation between Pand Q. PO=-2r+2
While mapping find the smallest value [-2r+2 0srsl
procedure to the required mapping from r, to of Zso that the value S is the closest to S. K So, p(r) = else where
---- (2)
Z, as shown in
table. straight line mentioned in
Applying the above transformation mentioned in equation ( )to a
equation (2) we get
T() = S= (-2w +2)dw =-p² +2r ---- (3)
102
derived
the
histogrampdf andlapply transformation
\mane Image Enhancement
103

the
Nowconsider
and
the points R |B in Fig. (b)i) is given by
line cquationbetween
Thestright |2z 0srsl
P.() = 0 else where

mentioned transformationequation (4)to the equation (5).


Applytheabove
G)=s=)de (b) Global histogram
(a) Original image
cqualization
where t is a dummy variable

Ge) =s=2 dt =[=z'


For histogram matching we know that
T(r) =s=G(2)
s=-+2r=, z=-P+2r

3.3.3 Local Enhancement equalization for


equalization (d) Loal histogram pixels
(c) Local histogram the region of 12
The histogram processing methods are global in the sense the pixels of the entire im for the region of 50 pixels
modified by atransformation function. Local enhancement is enhancing detail over the smal histogram equilization
Fig. 3.23 : Example of local
in the image. One of the best local enhancement method is local
histogram equilization. statistics for image enhancement
Fig. 3.23 (a) shows the image in which more
details are not visible. .Fig.3.23 (b) shor Use of Histogram representing discrete gray-levels in the
range
Tesult of Global histogram equalization. In this image contrast is denote a discrete random variablehistogram component corresponding to the value
visible in the dark area. Fig. 3.23(c) is increased little, more delalSE Let r
equalizationí [0, L-1], and letp(r) denotes the normalized
region of 50 pixels. Thisimage is the image obtained from local histogram obtained fron of r. The nlh moment of r about its
mean is defined as
histogram considerably good. Fig..3.23 (d) is the image
equalization for the region of 12 pixels. This image isScomparatively best imager ---- (3.20)
the four images.
4.) = X(-m)'plr)
i=0

Where m is the mean value of r.

1n =
i=0

is given by
Ho=1,, =0, the second moment
L-l ---- (3.21)
4,(r) = X-m)'p(;)
\mage p Image Enhancement 105
104
(r).
r denoted by o
4() is varianceof the square ro0t of the
Thestandard
The
deviationis defined simply as variance.
mean is the measure of average gray level in an image. The variance is the tmca Variance o' =
L-1

-m P(a)
i=0
average contrastin an image. The global mean and variance are measured over an enite,
and are useful adjustments of overall intensity and contrast. The local mean and varia 9

measured over an predefined region ofthe image and are useful for adjustments of inten i=0
contrast over a predefined region of theimage. Let(, y) be the coordinates ofa pixel in an;
and let s denote a neighborhood(Submage of specified size centered at (x, y). The mean 3-4).
16
16
computed using the expression.
m, of the pixels in s can be (4-4+(5-4)+(6-4'(7-4
l6 16

(s./)Es
(8-4+(9-4)'=7437 =7
16
neigborhood.
where r, is the gray levelat coordinates (s, 1) in the
operations
pr )is the neighborhoodnormalized histogram component corresponding to that ul 3.3.4 Enhancement Using Arithmetic / Logic between
gray level. The gray - level variance of the pixels in regions, is given by performed on a pixel by pixel basisselecting
operations involving images are
Arithmetic / logic for
masking i.e.,
images. The logical operation AND and OR are used for
two or more
(s)es, sub images in an image.
The localmean is a measure of average gray level in neighborhood s, and the variang
standard deviation] is a measure of contrast in that neighborhood.
Example to illustrate the calculation of variance and means for the given image matrix.

1 2-4 8
2 01 5
A=
35 6 4
|6 7 9 0|

Mean:
m =
i=0
Here
L= 100
mask
inages forOR andAND
Fig. 3.24: Example represents a binary I
m= P) the OR and AND image masks. Light area processing. In the
Fig.3.24 (b) and (c)
shows Interest (ROI)
i=)
binary 0. Masking is
used in Region Of of the input
represents a chair. In case of OR Mask if any one
and dark the lamp behind the always one, irrespective
2
M=0x+lx+2x3x+4x image ROI is the top of input is one, the output is
16 dv 2 +6X 8ven
output follows the other input. Ifany ofthe by Truth table.
16 16 16 S Zero, better understand
16 16 of the other input. This can be
+7x-+8x
16 16
+9x
16
3.9375 4
106
talble of OR
\mage Pi Image Enhancement
107

Truth
B

0 0’
1
0
0 1

1 level bit
a) Original image b) 3lower order gray
planes set to zero
dark region dof the mask
image information only at the as
So OR mask will pass the if anyone of the input.is one output followsthe sho,
of (c).
IfFig.any3.24 Conversely in AND mask, other
the input is zero, the output is always zero, irrespective of the other input. Thisa
table of AND.
better understand by Truth
Truth table of AND

B Y
<- - A 0’
c)Difference between d) Histogram equalized
(a) and (b) difference image
image substraction
Fig. 3.25 :Example of obtained by
shows the image identical
0
Sunflower seeds image Fig. 3.25 (b) are almost
the images
1 1 Fig. 3.25 (a) showssignificant bit planes of the image in (a). The are lost. The pixel by pixel
least four little fine details
discarding the image and image appears
difference in contrast of theshown in Fig. 3.25 (c). The difference
So AND mask will pass the image information at light region of the mask as sho expect a slight two images is details in the image. histogram
Fig. 3.24 (e) difference between these pixel values. So in order to bringout 3.25 (d).
ofsmall in Fig.
almost black bccause the result is shown
on the image and
Image Subtraction equalization is performed
The difference between two images f(x, y) and h (x, y)
expressed as
& i,y) = f( y) hlr, y)
Image subtration is usedinthe area of medical imaging called I mask mode radiography.y.ot
case h(x, y), the mask is an x - ray image of a region of apatients body. AContrast medur
injected into the patient's bloodstream, take the image of the same anatomical region asfl mask subtracted
out
The netc effect of subtracting the
mask from each c) Image with
of TVimagt
that the areas that are
Image values should be different between f(x, y) andsample
h(x, y)
in the incoming Stream
appear in
as enhancedde
a) Mask Image
in the range the image
can range from a (0-255) image is displayed using 8 bits. The values
difference as
image
255 to every pixel and minimum of- 255 to a maximum of 255. One methoddis i to
8 - bit range from 0tothen divide by 2. It is not theent
255. guaranteed that the values willdifference
negative is added to all the Second method is to find the
cover
an
pixels in the value of the min
difference image and multiplied lby 255/max. ofa
contrast
taken afterejectionstream
b) Image
medium intothe
blood substraction
of image
application
3.26: Practical
Fig.
108
blood stream image prior
to injection of an contrast
\rmage P 109
Fig. 3.25 (a) shows the injection Fig. 3.25(b)showss the image of blood Image Enhancernent

streamm.Fetiium
time of
bloodstream after some subtracted out in which blood stream is visible the response (R) is
Eorthe 3x3 ilter mask at a point (x, y) in the image,
shows theimage with
mask
more in dea R=w(-I, -)f(- l, y-1) + w(-1,0) f(r-1. y) +... -..(3.29)
Image Averaging + w (1, )f(r+ 1. y + )
+ w (0, 0) f(x, y) t .... w (1, 0)f (+ 1, y)
astrophotography, but it the computation of the sum of products
Image averaging is common in high - end does give good
requires severalimages oftthe same
The mask is centered at (x,y) of the image whenm=2u+ 1 and n = 2b+ 1, where a and b are
assume that
night photography. Averaging takes place. For a mask of size mX. We filter mask of
low light
different
and
noise pattern. Averaging reduces the noise without compromising detailsSas icach
t
sCene non-negative integers. In general, linear filtering
of an image fof size Mx N with a
signal to noise matix (SNR) of the. image. Noise in the image is trurely random, inag size m xn is given by the
expression.
fluctuations above and belowactual image data will gradually even out as one
more images. averageS TN g(1, y) = s=-0 (z-h
w(s,)f (x+s,y+ t) -.-(3.30)

Consider a noisy image g(x, y) formed by the addition of noise n(a, y)to an
f(xy): that is original; where 1= (m-1)/ and b=
8 ,y) =f, y) + n4, y) Image origin

An image g (r, y) is formed by averaging different k noisy images. Image flx, y)


K
y) =
Mask

E| (,)} =fu. y)

where orw) and ocry are


the-variances ofn and g at coordinates (x, y) w(-1,-1) w-1,0| w(-1,1)
As the noise is random the
variance
image. So if variance is reduced one can in the nojse image will be much more than the ot
consider the w(0,-1 w(0,0) w(0, 1)
Reduction of noise can be observed in the noise has also reduced in the tag
average image g (, y) as k
3.4 Spatial Filtering increases. w(1,1)| w(1,0) w(1,1)

fx-1,y-1 f(x-1,y) fx-1,y+1)


Spatial domain Mask coefficient

processing techniquesapproaches are


are based on direct manipulation of pixels in an Frequency do:
showing
coordinates
Basis of Spatial Filtering modifying the Fourier transform ofimage. an image. arrangement
flx,y-1) flx, y) |f(x.y +1)

A
square matrix w(s, 1) is a f(x+1,y-1 f(x+1,ylF(x+1,y-1
spatial
iltering in images. The called
than pixels. values filter
of this mask, kernel, template orrwindow whenit is used
The
simply of moving the
i mechani
filtersmmask spatial
of
fi lterin g
matrix (filter) are ra
are inreferred to as coefficients.Cons
is centered Pixels of image
for the filter window. Atfrom point to point il ustrated Fig. section under

image, 3.27.The pixelinthe in:


the filter in process
coefficients and the each point (x, y) theanresponse
corresponding image pixels in the areasuchis giventhat every
mask

produc
by asum offilter Mechanisms of spatial filtering
mas Fig. 3.27: The image section
x3 mask of the
spanned by the
The Magnified view show a 3

You might also like