0% found this document useful (0 votes)
34 views30 pages

Image Histogram Analysis and Equalization

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views30 pages

Image Histogram Analysis and Equalization

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

The histogram of a digital image with

grey levels from 0 to L-1 is a discrete


function
h(rk) = nk
where:
• rk is the k-th grey level

• nk is the number of pixels in the image with that

grey level
• N is the total number of pixels in the image
• k = 0, 1, 2, …, L-1

2
Histogram
The (intensity or brightness) histogram shows how
many times a particular grey level (intensity) appears
in an image.

For example, 0 - black, 255 – white


7

0 1 1 2 4 6
5
2 1 0 0 2 4
3
5 2 0 0 4 2
1
1 1 2 4 1 0
0 1 2 3 4 5 6

image histogram
3
Normalized Histogram

4
Normalizing histograms with rest to the
total number of pixels converts these into
probability density like function

Histogram processing yields robust image


processing results

Are
histograms
unique ???

Histograms of both the images are same !!


5
In the dark images, components of the histogram
are concentrated on the low (dark) side of the gray
scale.
In bright images, the histogram is biased towards
the high side of the gray scale.

6
In image with low contrast, the histogram will be
narrow & centred towards the middle of the gray
scale.
An image with high contrast & a large variety of gray
tones will have pixels that occupy the entire range of
possible gray levels & are uniformly distributed.

7
An image has low contrast when the complete range of
possible values is not used. Inspection of the
histogram shows this lack of contrast.

8
It is the process that transforms the
intensity values so that the histogram of
the output image approximately
matches the flat (uniform) histogram.

9
A gray scale transformation for contrast
enhancement is usually found automatically
using the Histogram equalization technique.

The aim is to create an image with equally


distributed brightness levels over the whole
brightness scale.

10
Histogram Equalization

Example:

We are looking for


this transformation !

11
The Process …

12
We assume that the transformation function T(r)
satisfies the following conditions:

a)T(r) is single-valued & monotonically increasing


in the interval 0 ≤ r ≤ 1
The monotonicity condition preserves the
increasing order from black to white in the o/p
image.
b)0 ≤ T(r) ≤ 1 for 0 ≤ r ≤ 1

13
14
The discrete transformation function is given by:

The o/p image is obtained by mapping each pixel


with level rk in the i/p image into a corresponding
pixel with level sk in the o/p image with the help
of the above equation.
15
The following equations bring back the
gray levels in the range [0, L-1]

Discrete values:
k
sk  T (rk )  ( L  1) pr (rj )
j 0
k nj L 1 k
 ( L  1)   nj k=0,1,..., L-1
j  0 MN MN j 0

M – no. of rows
N – no. of columns
MN – total no. of pixels in the image
16
Example: Histogram Equalization
Suppose that a 3-bit image (L=8) of size 64 × 64 pixels
(MN = 4096) has the intensity distribution shown in
following table.
Get the histogram equalization transformation function
and give the ps(sk) for each sk.

17
1
0
s0  T (r0 )  7 pr (rj )  7  0.19  1.33
j 0

3
1
s1  T (r1 )  7 pr (rj )  7  (0.19  0.25)  3.08
j 0

s2  4.55  5 s3  5.67  6
s4  6.23  6 s5  6.65  7
s6  6.86  7 s7  7.00  7
18
Histogram equalization

19
There are applications in which attempting
to base enhancement on a uniform
histogram is not the best approach
Sometimes it is useful to be able to specify
the shape of the histogram that we wish
the processed image to have.
The method used to generate a processed
image that has a specified histogram is
called

20
For a image, whose enhancement is to be
done, we are given an histogram, G(zk), that
actually shows how the processed image’s
histogram should look after applying the
transformation function to the i/p image.
sk = T(rk)

zk = G-1(sk) = G-1[T(rk)]

k = 0, 1, …, L-1
21
Histogram Matching: Discrete Cases

 Obtain pr(rj) from the input image


and then obtain the values of sk,
round the value to the integer range
[0, L-1].
 Use the specified histogram and
obtain the transformation function
G(zq), round the value to the integer
range [0, L-1].

 Mapping from sk to zq
22
Example: Histogram Matching
Suppose that a 3-bit image (L=8) of size 64 × 64
pixels (MN = 4096) has the intensity distribution
shown in the following table (on the left). Get the
histogram transformation function and make the
output image with the specified histogram, listed in
the table on the right.

23
Obtain the scaled histogram-equalized values,
s0  1, s1  3, s2  5, s3  6, s4  7,
s5  7, s6  7, s7  7.
Compute all the values of the transformation function G,
0
G ( z0 )  7 pz ( z j )  0.00
j 0

G ( z1 )  0.00 G ( z2 )  0.00
G ( z3 )  1.05 G ( z4 )  2.45
G ( z5 )  4.55 G ( z6 )  5.95
G ( z7 )  7.00

24
25
Example: Histogram Matching
Obtain the scaled histogram-equalized values,

s0  1, s1  3, s2  5, s3  6, s4  7,
s5  7, s6  7, s7  7.
Compute all the values of the transformation function G,
0
G ( z0 )  7 pz ( z j )  0.00 0
j 0

G ( z1 )  0.00 0 G ( z2 )  0.00  0
G ( z3 )  1.05  1 s0 G ( z4 )  2.45  2 s1
G ( z5 )  4.55  5 s2 G ( z6 )  5.95  6 s3
G ( z7 )  7.00 7 s4 s5 s6 s7

26
Histogram Matching

s0  1, s1  3, s2  5, s3  6, s4  7,
s5  7, s6  7, s7  7.

rk
0
1
2
3
4
5
27 6
7
Histogram Matching
rk  zq
03
1 4
25
36
47
57
67
77
28
 Define a neighborhood (e.g. a square or rectangle) and
move its center from pixel to pixel.

 At each location, the histogram of the points in the


neighborhood is computed. Either histogram equalization
or histogram specification transformation function is
obtained

 Map the intensity of the pixel centered in the


neighborhood

 Move to the next location and repeat the procedure

29
30

You might also like