Histogram equalization

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Alex:D (talk | contribs) at 12:17, 22 January 2008 (→‎Small image). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Histogram equalization is a method in image processing of contrast adjustment using the image's histogram.

Overview

This method usually increases the local contrast of many images, especially when the usable data of the image is represented by close contrast values. Through this adjustment, the intensities can be better distributed on the histogram. This allows for areas of lower local contrast to gain a higher contrast without affecting the global contrast. Histogram equalization accomplishes this by effectively spreading out the most frequent intensity values.

The method is useful in images with backgrounds and foregrounds that are both bright or both dark. In particular, the method can lead to better views of bone structure in x-ray images, and to better detail in photographs that are over or under-exposed. A key advantage of the method is that it is a fairly straightforward technique and an invertible operator. If the histogram equalization function is known, then the original histogram can be recovered. The calculation is not computationally intensive. A disadvantage of the method is that it is indiscriminate. It may increase the contrast of background noise, while decreasing the usable signal.

This method seems to be used in biological neural networks so as to maximize the output firing rate of the neuron as a function of the input statistics. This has been proved in particular in the fly retina.[1]

Back projection

The back projection (or "back project") of a histogrammed image is the re-application of the modified histogram to the original image, functioning as a look-up table for pixel brightness values.

For each group of pixels taken from the same position from all input single-channel images the function puts the histogram bin value to the destination image, where the coordinates of the bin are determined by the values of pixels in this input group. In terms of statistics, the value of each output image pixel characterizes probability that the corresponding input pixel group belongs to the object whose histogram is used.[2]

Implementation

Consider a discrete grayscale image, and let be the number of occurrences of gray level . The probability of an occurrence of a pixel of level in the image is

being the total number of gray levels in the image, being the total number of pixels in the image, and being in fact the image's histogram, normalized to .

Let us also define as the cumulative distribution function corresponding to , defined by:

,

also known as the image's accumulated normalized histogram.

We would like to create a transformation of the form that will produce a level for each level in the original image, such that the cumulative probability function of will be linearized across the value range. The transformation is defined by:

Notice that the T maps the levels into the domain of . In order to map the values back into their original domain, the following simple transformation needs to be applied on the result:

The above describes histogram equalization on a greyscale image. However it can also be used on color images by applying the same method separately to the Red, Green and Blue components of the RGB color values of the image.

Examples

Small image

The following is the same 8x8 subimage as used in JPEG. The 8-bit greyscale image shown has the following values:

The histogram for this image is shown in the following table. Pixel values that have a zero count are excluded for the sake of brevity.

Value Count Value Count Value Count Value Count Value Count
52 1 64 2 72 1 85 2 113 1
55 3 65 3 73 2 87 1 122 1
58 2 66 2 75 1 88 1 126 1
59 3 67 1 76 1 90 1 144 1
60 1 68 5 77 1 94 1 154 1
61 4 69 3 78 1 104 2
62 1 70 4 79 2 106 1
63 2 71 2 83 1 109 1

The cumulative distribution function (cdf) is shown below. Again, pixel values that do not contribute to an increase the cdf are excluded for brevity.

Value cdf Value cdf Value cdf Value cdf Value cdf
52 1 64 19 72 40 85 51 113 60
55 4 65 22 73 42 87 52 122 61
58 6 66 24 75 43 88 53 126 62
59 9 67 25 76 44 90 54 144 63
60 10 68 30 77 45 94 55 154 64
61 14 69 33 78 46 104 57
62 15 70 37 79 48 106 58
63 17 71 39 83 49 109 59

This cdf shows that the minimum value in the subimage is 52 and the maximum value is 154. The cdf of 64 for value 154 coincides with the number of pixels in the image. The cdf must be normalized to . The general histogram equalization formula is:

Where cdfmin is the minimum value of the cumulative distribution function (in this case 1), M × N gives the image's number of pixels (for the example above 64, where M is width and N the height) and L is the number of grey levels used (in most cases, like this one, 256). The equalization formula for this particular example is:

For example, the cdf of 78 is 46. (The value of 78 is used in the bottom row of the 7th column.) The normalized value becomes

Once this is done then the values of the equalized image are directly taken from the normalized cdf to yield the equalized values:

Notice that the minimum value (52) is now 0 and the maximum value (154) is now 255.

Original Equalized

Full-sized image

An unequalized image
Corresponding histogram
The same image after histogram equalization
Corresponding histogram

Notes

  1. ^ Laughlin, S.B (1981). "A simple coding procedure enhances a neuron's information capacity". Z. Naturforsch. 9–10(36):910–2.
  2. ^ Intel Corporation (2001). "Open Source Computer Vision Library Reference Manual" (PDF). Retrieved 2006-08-18. {{cite journal}}: Cite journal requires |journal= (help)

References

  • Acharya and Ray, Image Processing: Principles and Applications, Wiley-Interscience 2005 ISBN 0-471-71998-6
  • Russ, The Image Processing Handbook: Fourth Edition, CRC 2002 ISBN 0-8493-2532-3

External links