# Histogram equalization

﻿
Histogram equalization

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.

In scientific imaging where spatial correlation is more important than intensity of signal (such as separating DNA fragments of quantized length), the small signal to noise ratio usually hampers visual detection. Histogram equalization provides better detectability of fragment size distributions, with savings in DNA replication, toxic fluorescent markers and strong UV source requirements, whilst improving chemical and radiation risks in laboratory settings, and even allowing the use of otherwise unavailable techniques for reclaiming those DNA fragments unaltered by the partial fluorescent marking process.

Histogram equalization often produces unrealistic effects in photographs; however it is very useful for scientific images like thermal, satellite or x-ray images, often the same class of images that user would apply false-color to. Also histogram equalization can produce undesirable effects (like visible image gradient) when applied to images with low color depth. For example if applied to 8-bit image displayed with 8-bit gray-scale palette it will further reduce color depth (number of unique shades of gray) of the image. Histogram equalization will work the best when applied to images with much higher color depth than palette size, like continuous data or 16-bit gray-scale images.

There are two ways to think about and implement histogram equalization, either as image change or as palette change. The operation can be expressed as "P(M(I))" where "I" is the original image, "M" is histogram equalization mapping operation and "P" is a palette. If we define new palette as "P'=P(M)" and leave image I unchanged than histogram equalization is implemented as palette change. On the other hand if palette P remains unchanged and image is modified to "I'=M(I)" than the implementation is by image change. In most cases palette change is better as it preserves the original data.

Generalizations of this method use multiple histograms to emphasize local contrast, rather than overall contrast. Examples of such methods include adaptive histogram equalization and "contrast limiting adaptive histogram equalization" or CLAHE.

Histogram equalization also 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. [cite journal|last=Laughlin|first=S.B|year=1981|title=A simple coding procedure enhances a neuron’s information capacity|journal=Z. Naturforsch.|volume=9–10(36):910–2]

Histogram equalization is a specific case of the more general class of histogram remapping methods. These methods seek to adjust the image to make it easier to analyze or improve visual quality (e.g., retinex)

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. [cite paper|author=Intel Corporation|title=Open Source Computer Vision Library Reference Manual|date=2001|url=http://www.itee.uq.edu.au/~iris/CVsource/OpenCVreferencemanual.pdf|format=PDF|accessdate=2006-08-18]

Implementation

Consider a discrete grayscale image, and let $n_i$ be the number of occurrences of gray level $i$. The probability of an occurrence of a pixel of level $i$ in the image is :$p\left(x_i\right) = frac\left\{n_i\right\}\left\{n\right\}, iin \left\{0,..., L - 1\right\}$$L$ being the total number of gray levels in the image, $n$ being the total number of pixels in the image, and $p$ being in fact the image's histogram, normalized to $\left[0,1\right]$.

Let us also define $c$ as the "cumulative distribution function" corresponding to $p$, defined by::$c\left(i\right) = sum_\left\{j=0\right\}^i p\left(x_j\right)$,also known as the image's accumulated normalized histogram.

We would like to create a transformation of the form $,y = T\left(x\right)$ that will produce a level $y$ for each level $x$ in the original image, such that the cumulative probability function of $y$ will be linearized across the value range. The transformation is defined by: :$,y_i = T\left(x_i\right) = c\left(i\right)$

Notice that the T maps the levels into the domain of $\left\{0..1\right\}$. In order to map the values back into their original domain, the following simple transformation needs to be applied on the result::$y_i\text{'} = y_i cdot\left(max - min\right) + min$

Histogram Equalization of Color Images

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. Still, it should be noted that applying the same method on the Red, Green, and Blue components of an RGB image may yield dramatic changes in the image's color balance since the relative distributions of the color channels change as a result of applying the algorithm. However, if the image is first converted to another color space, Lab color space, or HSL/HSV color space in particular, then the algorithm can be applied to the luminance or value channel without resulting in changes to the hue and saturation of the image.

Examples

=Small

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.:

=Full-sized

Notes

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

* [http://www.generation5.org/content/2004/histogramEqualization.asp "Histogram Equalization" at Generation5]
* [http://opencvlibrary.sourceforge.net/CvReference#cv_imgproc_histograms Open Source Computer Vision Library Wiki: Histograms]
* [http://fourier.eng.hmc.edu/e161/lectures/contrast_transform/node3.html Page by Ruye Wang with good explanation and pseudo-code]

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• Adaptive histogram equalization — is a computer image processing technique used to improve contrast in images. It differs from ordinary histogram equalization in the respect that the adaptive method computes several histograms, each corresponding to a distinct section of the… …   Wikipedia

• Equalization (disambiguation) — Equalization is correction for frequency dependent processing of audio signals.Equalization may also be:* Equalization (computing) * Equalization of pressure within the ear, a.k.a. ear clearing * Financial processes: ** Factor price equalization… …   Wikipedia

• Image histogram — An image histogram is type of histogram which acts as a graphical representation of the tonal distribution in a digital imagecite web | work = Illustrated Photography | title = Histograms and the Zone System | author = Ed Sutton |… …   Wikipedia

• CLAHE — In Image Processing, CLAHE stands for Contrast Limited Adaptive Histogram Equalization. CLAHE is a technique used to improve the local contrast of an image. It is a generalization of adaptive histogram equalization and ordinary histogram… …   Wikipedia

• Comparison of image processing software — The following table provides a comparison of image processing software. Functionality Matlab*[1] Mathematica[2] imageJ FIJI (software) Population Extract alpha channel No …   Wikipedia

• YIQ — is the color space used by the NTSC color TV system, employed mainly in North and Central America, and Japan. In the U.S., currently federally mandated for analog over the air TV broadcasting as shown in this excerpt of the current FCC rules and… …   Wikipedia

• Shadow and highlight enhancement — refers to an image processing technique to correct exposure. Images with over and under exposed areas can be recovered with the Shadow/Highlight tool in Photoshop. Though this tool can be used to darken overexposed highlights, it is used… …   Wikipedia

• List of computer vision topics — This is a list of computer vision and image processing topics Contents 1 Image enhancement 2 Transformations 3 Filtering, Fourier and wavelet transforms and image compression …   Wikipedia

• Chasys Draw IES — Developer(s) John Paul Chacha s Lab [1] Stable release 3.66.02 / 5 September 2011; 51 days ago (2011 09 05) Operating system …   Wikipedia

• List of topics in aesthetics — List of topics in aesthetics. (See also: List of aestheticians.)* A Mathematician s Apology * A Philosophical Enquiry into the Origin of Our Ideas of the Sublime and Beautiful * Abhinavagupta * Abstract Illusionism * Abstract art * Academic art * …   Wikipedia