0% found this document useful (0 votes)
2 views5 pages

Histogram

The document discusses histogram processing in digital image and video processing, explaining concepts such as histogram definition, stretching, sliding, equalization, and specification. It details how histograms can be used for image enhancement and provides numerical examples for each technique. The document emphasizes the importance of histograms in improving image quality and controlling pixel distribution.

Uploaded by

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

Histogram

The document discusses histogram processing in digital image and video processing, explaining concepts such as histogram definition, stretching, sliding, equalization, and specification. It details how histograms can be used for image enhancement and provides numerical examples for each technique. The document emphasizes the importance of histograms in improving image quality and controlling pixel distribution.

Uploaded by

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

1|Page Digital Image and Video Processing (PE-EC702B)

MODULE 2B: HISTOGRAM PROCESSING

1. What do you mean by histogram of an image?


The histogram of a digital image with intensity levels in the range [0, L - 1] is a discrete function h(r k) =
nk, where rk is the kth intensity value and nk is the number of pixels in the image with intensity rk. It is a
common practice to normalize a histogram by dividing each of its components by the total number of
pixels in the image, denoted by the product MN, where, as usual, M and N are the row and column
dimensions of the image. Thus, a normalized histogram is given by p(r k) = nk /MN, for k = 0, 1, 2, …, L
- 1. Loosely speaking, p(rk) is an estimate of the probability of occurrence of intensity level r k in an
image. The sum of all components of a normalized histogram is equal to 1.
Histograms are the basis for numerous spatial domain processing techniques. Histogram manipulation
can be used for image enhancement. Histograms are simple to calculate in software and also lend
themselves to economic hardware implementations, thus making them a popular tool for real-time image
processing.

2. Show the histograms of dark image, bright image, low contrast image and high contrast image.
The horizontal axis of each histogram plot corresponds to intensity values, r k. The vertical axis
corresponds to values of h(rk) = nk or p(rk) = nk /MN if the values are normalized. Thus, histograms may
be viewed graphically simply as plots of h(rk) = nk versus rk or p(rk) = nk /MN versus rk.

In the dark image the components of the histogram are concentrated on the low (dark) side of the
intensity scale. Similarly, the components of the histogram of the light image are biased toward the high
side of the scale. An image with low contrast has a narrow histogram located typically toward the
middle of the intensity scale. Finally, we see that the components of the histogram in the high-contrast
image cover a wide range of the intensity scale and, further, that the distribution of pixels is not too far
PREPARED BY: DWAIPAYAN GHOSH, ASSISTANT PROFESSOR OF ECE
2|Page Digital Image and Video Processing (PE-EC702B)
MODULE 2B: HISTOGRAM PROCESSING

from uniform, with very few vertical lines being much higher than the others. Intuitively, it is reasonable
to conclude that an image, whose pixels tend to occupy the entire range of possible intensity levels and,
in addition, tend to be distributed uniformly, will have an appearance of high contrast and will exhibit a
large variety of gray tones. The net effect will be an image that shows a great deal of gray level details
and has high dynamic range.

3. Explain histogram stretching in brief.


The aim of this transformation is to spread the histogram to cover the entire dynamic range, instead of
changing the shape of the histogram. This operation is also known as histogram sca1ing. The mapping
function for histogram stretching is given as follows:
𝑆 −𝑆
𝑟 − 𝑟
and the transform is given as follows:
𝑆 −𝑆
(𝑟 − 𝑟 ) + 𝑆
𝑟 − 𝑟
Here Smax and Smin are the maximum and minimum of the pixel values in the stretched histogram
respectively and rmax and rmin are the maximum and minimum grey level values of the original image
respectively. The transformation improves the contrast.

Numerical: Perform histogram stretching on the 8 x 8, eight-level grey image, the grey-level
distribution of which is shown in table below.
Image grey level distribution
Grey Levels (rk) 0 1 2 3 4 5 6 7
Number of pixels (pk) 0 0 5 20 20 19 0 0
Solution: It can be observed that the image ranges from grey level 2 to grey level 5 only. This has to be
stretched to cover the entire range 0-7 for enhancing the quality of the image.
Now rmin = 2, rmax=5, Smin=0, and Smax= 7. Therefore,
7−0
𝑆= [𝑟 − 2] + 0
5−2
7
= [𝑟 − 2]
3
When r=2, S=0
r=3, S=2.33 ≈ (grey level 2)
r=4, S=4.66 ≈ (grey level 5)
r=5, S=7
r=6, S=7
r=7, S=7
The resultant mapping will be S=0 corresponding to r=2. Therefore, the pixels that have grey level r=2
in the original image have to be mapped to level S=0 in the resultant image. The fina1 mappings are
shown below:
PREPARED BY: DWAIPAYAN GHOSH, ASSISTANT PROFESSOR OF ECE
3|Page Digital Image and Video Processing (PE-EC702B)
MODULE 2B: HISTOGRAM PROCESSING

Image grey level distribution


Grey Levels (rk) 0 1 2 3 4 5 6 7
Number of pixels (pk) 5 0 20 0 0 20 0 19

4. What do you mean by histogram sliding?


This operation can make an image either darker or lighter, but retains the relationship
between grey-level values. It can be represented as follows:
S = slide(r) = r + offset
Here, an offset is the extent used to slide the histogram. A positive value increases brightness, and a
negative value creates a darker image.

5. Explain histogram equalization is details.


This technique is similar to histogram stretching. It tries to flatten the histogram to create a better quality
image. It treats an image as a probability distribution. It first finds the cumulative distributive function
after which it normalizes the values and performs respective mapping. The histogram equalization
process is summarized in the following steps:
1. Form the cumulative histogram.
2. Normalize the value by dividing it by the total number of pixels.
3. Multiply the value by the maximum grey-level value and round off the value.
4. Map the original value to the result of step 3 by a one-to-one correspondence.
This process will equalize the histogram. Histogram equalization may not always
provide the desired effect because its aim is to distribute the pixels evenly.

Numerical: Perform histogram equalization on the 8*8, eight level image described below:
Pixel distribution of the image
rk 0 1 2 3 4 5 6 7
pk 8 10 10 2 12 16 4 2

Solution: The equalization process for the given image is shown below.
Image equalization process
rk pk Cumulative * (L-1) Round off to the
running of pixels nearest grey level
0 8 8 8/64 * 7 = 0.875 1
1 10 18 18/64 * 7 = 1.968 2
2 10 28 28/64 * 7 = 3.0625 3
3 2 30 30/64 * 7 = 3.2812 3
4 12 42 42/64 * 7 = 4.5937 5
5 16 58 58/64 * 7 = 6.3437 6
6 4 62 62/64 * 7 = 6.78125 7
7 2 64 64/64 * 7 = 7 7
PREPARED BY: DWAIPAYAN GHOSH, ASSISTANT PROFESSOR OF ECE
4|Page Digital Image and Video Processing (PE-EC702B)
MODULE 2B: HISTOGRAM PROCESSING

It shows the final distribution of grey scale pixels where pixels 28 and 30 corresponding to levels 2 and
3, respectively are mapped to level 3 in the resultant image. Similarly, pixels 62 and 64 are mapped to
level 7 in the resultant image.
Finally grey-level distribution
Grey levels (rk) 0 1 2 3 4 5 6 7

Modified Grey levels 1 2 3 3 5 6 7 7

6. What do you mean by histogram specification?


A user has no control over the histogram normalization process. However, histogram
equalization allows exercising control over the process through target histogram specification. The
algorithm for histogram specification is as follows:

1. Find the mapping table of histogram equalization.


2. Specify the desired histogram. Equalize the desired histogram.
3. Perform the mapping process so that the values of Step 1 can be mapped to the results
of Step 2.

Numerical: Perform histogram specification on the 8*8, eight level image described below:

Pixel distribution of the image

rk 0 1 2 3 4 5 6 7

pk 8 10 10 2 12 16 4 2

The target histogram is shown below:

Pixel distribution of the image

rk 0 1 2 3 4 5 6 7

pk 0 0 0 0 20 20 16 8

Solution: The equalization process for this image was already carried out in the previous numerical. The
next step is to equalize the target histogram.
Equalization of target histogram
rk pk Cumulative * (L-1) Round off to
running of pixels the nearest
grey level
0 0 0 0 0
1 0 0 0 0
2 0 0 0 0
3 0 0 0 0
PREPARED BY: DWAIPAYAN GHOSH, ASSISTANT PROFESSOR OF ECE
5|Page Digital Image and Video Processing (PE-EC702B)
MODULE 2B: HISTOGRAM PROCESSING

4 20 20 20/64 * 7 = 2.1875 2
5 20 40 40/64 * 7 = 4.375 4
6 16 56 56/64 * 7 = 6.125 6
7 8 64 64/64 * 7 = 7 7

Thus the mapping obtained from equalization process is:

rk Closest level
0 0
1 0
2 0
3 0
4 2
5 4
6 6
7 7
Now we map the values from the source to the target. The final mapping between the source and the
target histograms is given below:

Rows (grey H (mappings of the S (mappings of the Map


levels) equalization) equalization of the target)
0 1 0 4
1 2 0 4
2 3 0 5
3 3 0 5
4 5 2 6
5 6 4 6
6 7 6 7
7 7 7 7

Now, the resultant mapping can be found by taking the equalized value H and searching co1umn S. In
this case, take a value, say l, and search in the specification column. In column S, the closest value is 2,
which is present in row 4. Hence, the new mapping is 4. In the case of a clash, the choice should be the
largest value, in order to provide maximum contrast. However, by picking the smallest value, a more
gradually changing image is obtained.

PREPARED BY: DWAIPAYAN GHOSH, ASSISTANT PROFESSOR OF ECE

You might also like