The histogram of a digital image with gray levels in the range [0, L-1] is a discrete function h(rk)
= (nk), where rk is the kth gray level and nk is the number of pixels in the image having gray level rk. It is common practice to normalize a histogram by dividing each of its values by the total number of pixels in the image, denoted by n. Thus, a normalized histogram is given by
for k=0,1,…… .,L-1. Loosely speaking, p(rk) gives an estimate of the probability of occurrence of gray level rk. Note that 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 effectively 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.
As an introduction to the role of histogram processing in image enhancement, consider Fig. 3, which is the pollen image shown in four basic gray-level characteristics: dark, light, low contrast, and high contrast.The right side of the figure shows the histograms corresponding to these images. The horizontal axis of each histogram plot corresponds to gray level values, rk.
The vertical axis corresponds to values of h(rk) = nk or p(rk) = nk/n if the values are normalized.Thus, as indicated previously, these histogram plots are simply plots of h(rk) = nk versus rk or p(rk) = nk/n versus rk.
Fig.3 Four basic image types: dark, light, low contrast, high contrast, and their corresponding histograms.
We note in the dark image that the components of the histogram are concentrated on the low (dark) side of the gray scale. Similarly, the components of the histogram of the bright image are biased toward the high side of the gray scale.An image with low contrast has a histogram that will be narrow and will be centered toward the middle of the gray scale. For a monochrome image this implies a dull,washed-out gray look. Finally,we see that the components of the histogram in the high-contrast image cover a broad range of the gray scale and, further, that the distribution of pixels is not too far 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 gray 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 detail and has high dynamic
range. It will be shown shortly that it is possible to develop a transformation function that can automatically achieve this effect, based only on information available in the histogram of the input image.