Professional Documents
Culture Documents
Cumulative histogram
Effect of gray-level mapping on histogram
Histogram equalization
Histogram specification
Local enhancement
Color processing
Intensity Histogram
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.
char image[rows][cols];
int histogram[256];
int row, col, i;
for (i = 0; i < 256; i++) histogram[j]=0;
for (row = 0; row < rows; row++)
for(col = 0; col < cols; col++)
histogram[(int) image[row][col]++;
Intensity Histogram - Guidelines for Use
Histograms have many uses. One of the more common is to decide what
value of threshold to use when converting a greyscale image to a binary
one by thresholding. If the image is suitable for thresholding then the
histogram will be bi-modal --- i.e. the pixel intensities will be clustered
around two well separated values. A suitable threshold for separating
these two groups will be found somewhere in between the two peaks in
the histogram. If the distribution is not like this then it is unlikely that a
good segmentation can be produced by thresholding.
The intensity histogram for the input image is
Intensity Histogram - Guidelines for Use
The histogram shows that most of the pixels have rather high intensity
values.
Intensity Histogram and Contrast stretching
Contrast stretching the image yields
which has a clearly improved contrast.
We can see that now the pixel values are distributed over the
entire intensity range. Due to the discrete character of the pixel
values, we can't increase the number of distinct intensity
values.
That is the reason why the stretched histogram shows the gaps
between the single values.
Intensity Histogram and Contrast stretching
j
c j =∑hi
i =0
Cumulative histogram -
Conclusions
We must find a transformation T that maps grey values r in the input imag
F to grey values s = T(r) in the transformed image .
It is assumed that
T is single valued and monotonically increasing, and
for
r = T-1 (s).
An example of such a transfer function is
illustrated in the Figure
Histogram Equalization - Discrete Formulation
We first need to determine the probability distribution
of grey levels in the input image.
Note that
The histogram confirms what we can see by visual inspection: this image
has poor dynamic range. (Note that we can view this histogram as a
description of pixel probability densities by simply scaling the vertical
axis by the total number of image pixels and normalizing the horizontal
axis using the number of intensity density levels (i.e. 256). However, the
shape of the distribution will be the same in either case.)
Histogram Equalization Guidelines for Use
In order to improve the contrast of this image, without affecting the
structure (i.e. geometry) of the information contained therein, we
can apply the histogram equalization operator.
Histogram Equalization Guidelines for Use
Note that the histogram is not flat (as in the examples from the
continuous case) but that the dynamic range and contrast have been
enhanced. Note also that when equalizing images with narrow
histograms and relatively few gray levels, increasing the dynamic range
has the adverse effect of increasing visual grainyness. Compare this
result with that produced by the linear contrast stretching operator
http://www.netnam.vn/unescocourse/computervision/22.htm
http://homepages.inf.ed.ac.uk/rbf/HIPR2/histeq.htm