Image Processing Reference
In-Depth Information
Fig. 4.8 A histogram showing the age distribution of the guests at a party. The horizontal axis
represents age and the vertical axis represents the number of guests
dark, too bright or has too low a contrast, and automatically correct the image using
gray-level mapping. To this end we introduce a simple but powerful tool namely the
image histogram . Everybody processing images should always look at the histogram
of an image before processing it—and so should you!
A histogram is a graphical representation of the frequency of events. Say you are
at a party together with 85 other guests. You could then ask the age of each person
and plot the result in a histogram, as illustrated in Fig. 4.8 . The horizontal axis repre-
sents the possible ages and the vertical axis represents the number of people having
a certain age. Each column is denoted a bin and the height of a bin corresponds to
the number of guests having this particular age. This plot is the histogram of the age
distribution among the guests at the party. If you divide each bin with the total num-
ber of samples (number of guests) each bin now represents the fraction of guests
having a certain age—multiply by 100% and you have the numbers in percentages.
We can for example see that 11.6% of the guests are 25 years old. In the rest of this
topic we will denote the vertical axis in a histogram by frequency , i.e., the number
of samples.
We now do exactly the same for the pixel values of an image. That is, we go
through the entire image pixel-by-pixel and count how many pixels have the value
0, how many have the value 1, and so on up to 255. This results in a histogram with
256 bins and this is the image histogram.
If the majority of the pixels in an image have low values we will see this as most
high bins being to the left in the histogram and can thus conclude that the image is
dark. If most high bins are to the right in the histogram, the image will be bright. If
the bins are spread out equally, the image will have a good contrast and vice versa.
See Fig. 4.9 .
Note that when calculating an image histogram the actual position of the pixels
is not used. This means i) that many images have the same histogram and ii) that
an image cannot be reconstructed from the histogram. In Fig. 4.10 four images with
the same histogram are shown.
We can of course also calculate the histogram of a color image. This is done
separately for each color channel. An example is shown in Fig. 4.11 .
Search WWH ::

Custom Search