HOME

TheInfoList



OR:

Histogram equalization is a method in
image processing An image is a visual representation of something. It can be two-dimensional, three-dimensional, or somehow otherwise feed into the visual system to convey information. An image can be an artifact, such as a photograph or other two-dimensio ...
of contrast adjustment using the
image An image is a visual representation of something. It can be two-dimensional, three-dimensional, or somehow otherwise feed into the visual system to convey information. An image can be an artifact, such as a photograph or other two-dimensio ...
's
histogram A histogram is an approximate representation of the frequency distribution, distribution of numerical data. The term was first introduced by Karl Pearson. To construct a histogram, the first step is to "Data binning, bin" (or "Data binning, buck ...
.


Overview

This method usually increases the global contrast of many images, especially when the image is represented by a narrow range of intensity values. Through this adjustment, the intensities can be better distributed on the histogram utilizing the full range of intensities evenly. This allows for areas of lower local contrast to gain a higher contrast. Histogram equalization accomplishes this by effectively spreading out the highly populated intensity values which are used to degrade image contrast. 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 A bone is a rigid organ that constitutes part of the skeleton in most vertebrate animals. Bones protect the various other organs of the body, produce red and white blood cells, store minerals, provide structure and support for the body, ...
structure in
x-ray An X-ray, or, much less commonly, X-radiation, is a penetrating form of high-energy electromagnetic radiation. Most X-rays have a wavelength ranging from 10 picometers to 10  nanometers, corresponding to frequencies in the range 30&nb ...
images, and to better detail in photographs that are either over or under-exposed. A key advantage of the method is that it is a fairly straightforward technique adaptive to the input image and an invertible operator. So in theory, if the histogram equalization function is known, then the original histogram can be recovered. The calculation is not
computation Computation is any type of arithmetic or non-arithmetic calculation that follows a well-defined model (e.g., an algorithm). Mechanical or electronic devices (or, historically, people) that perform computations are known as ''computers''. An esp ...
ally intensive. A disadvantage of the method is that it is indiscriminate. It may increase the contrast of background
noise Noise is unwanted sound considered unpleasant, loud or disruptive to hearing. From a physics standpoint, there is no distinction between noise and desired sound, as both are vibrations through a medium, such as air or water. The difference aris ...
, 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 detections. Histogram equalization often produces unrealistic effects in photographs; however it is very useful for scientific images like thermal,
satellite A satellite or artificial satellite is an object intentionally placed into orbit in outer space. Except for passive satellites, most satellites have an electricity generation system for equipment on board, such as solar panels or radioiso ...
or
x-ray An X-ray, or, much less commonly, X-radiation, is a penetrating form of high-energy electromagnetic radiation. Most X-rays have a wavelength ranging from 10 picometers to 10  nanometers, corresponding to frequencies in the range 30&nb ...
images, often the same class of images to which one would apply
false-color False color (or pseudo color) refers to a group of color rendering methods used to display images in color which were recorded in the visible or non-visible parts of the electromagnetic spectrum. A false-color image is an image that depicts ...
. Also histogram equalization can produce undesirable effects (like visible
image gradient An image gradient is a directional change in the intensity or color in an image. The gradient of the image is one of the fundamental building blocks in image processing. For example, the Canny edge detector uses image gradient for edge detectio ...
) when applied to images with low
color depth Color depth or colour depth (see spelling differences), also known as bit depth, is either the number of bits used to indicate the color of a single pixel, or the number of bits used for each color component of a single pixel. When referring ...
. For example, if applied to 8-bit image displayed with 8-bit gray-scale palette it will further reduce
color depth Color depth or colour depth (see spelling differences), also known as bit depth, is either the number of bits used to indicate the color of a single pixel, or the number of bits used for each color component of a single pixel. When referring ...
(number of unique shades of gray) of the image. Histogram equalization will work the best when applied to images with much higher
color depth Color depth or colour depth (see spelling differences), also known as bit depth, is either the number of bits used to indicate the color of a single pixel, or the number of bits used for each color component of a single pixel. When referring ...
than
palette Palette may refer to: * Cosmetic palette, an archaeological form * Palette, another name for a color scheme * Palette (painting), a wooden board used for mixing colors for a painting ** Palette knife, an implement for painting * Palette (company) ...
size, like
continuous Continuity or continuous may refer to: Mathematics * Continuity (mathematics), the opposing concept to discreteness; common examples include ** Continuous probability distribution or random variable in probability and statistics ** Continuous g ...
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 Palette may refer to: * Cosmetic palette, an archaeological form * Palette, another name for a color scheme * Palette (painting), a wooden board used for mixing colors for a painting ** Palette knife, an implement for painting * Palette (company) ...
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 a new palette as ''P'=P(M)'' and leave image ''I'' unchanged then histogram equalization is implemented as
palette Palette may refer to: * Cosmetic palette, an archaeological form * Palette, another name for a color scheme * Palette (painting), a wooden board used for mixing colors for a painting ** Palette knife, an implement for painting * Palette (company) ...
change or mapping change. On the other hand, if palette P remains unchanged and image is modified to ''I'=M(I)'' then the implementation is accomplished by image change. In most cases palette change is better as it preserves the original data. Modifications of this method use multiple histograms, called subhistograms, to emphasize local contrast, rather than overall global contrast. Examples of such methods include
adaptive histogram equalization Adaptive histogram equalization (AHE) 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 corres ...
, ''contrast limiting adaptive histogram equalization'' or
CLAHE Adaptive histogram equalization (AHE) 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 corres ...
, multipeak histogram equalization (MPHE), and multipurpose beta optimized bihistogram equalization (MBOBHE). The goal of these methods, especially MBOBHE, is to improve the contrast without producing brightness mean-shift and detail loss artifacts by modifying the HE algorithm. A signal transform equivalent to histogram equalization also seems to happen in
biological neural networks A neural circuit is a population of neurons interconnected by synapses to carry out a specific function when activated. Neural circuits interconnect to one another to form large scale brain networks. Biological neural networks have inspired the ...
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 Flies are insects of the order Diptera, the name being derived from the Greek δι- ''di-'' "two", and πτερόν ''pteron'' "wing". Insects of this order use only a single pair of wings to fly, the hindwings having evolved into advanced ...
retina The retina (from la, rete "net") is the innermost, light-sensitive layer of tissue of the eye of most vertebrates and some molluscs. The optics of the eye create a focused two-dimensional image of the visual world on the retina, which the ...
. 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 Color constancy is an example of subjective constancy and a feature of the human color perception system which ensures that the perceived color of objects remains relatively constant under varying illumination conditions. A green apple ...
)


Back projection

The back projection (or "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 the probability that the corresponding input pixel group belongs to the object whose histogram is used.


Implementation

Consider a discrete grayscale image and let ''ni'' 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_x(i) = p(x=i) = \frac,\quad 0 \le i < L \ L being the total number of gray levels in the image (typically 256), ''n'' being the total number of pixels in the image, and p_x(i) being in fact the image's histogram for pixel value i, normalized to ,1 Let us also define the ''
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Eve ...
'' corresponding to ''i'' as :\operatorname_x(i) = \sum_^i p_x(x=j), which is also the image's accumulated normalized histogram. We would like to create a transformation of the form \ y=T(x) to produce a new image , with a flat histogram. Such an image would have a linearized cumulative distribution function (CDF) across the value range, i.e. :\operatorname_y(i) = (i+1) K for 0 \le i < L for some constant \ K . The properties of the CDF allow us to perform such a transform (see
Inverse distribution function In probability and statistics, the quantile function, associated with a probability distribution of a random variable, specifies the value of the random variable such that the probability of the variable being less than or equal to that value equ ...
); it is defined as :\ y = T(k) = \operatorname_x(k) where \ k is in the range ,L-1 . Notice that \ T maps the levels into the range ,1 since we used a normalized histogram of . In order to map the values back into their original range, the following simple transformation needs to be applied on the result: :\ y^\prime = y \cdot(\max\ - \min\) + \min\= y \cdot(L- 1). A more detailed derivation i
provided here
\ y is a real value while \ y^\prime has to be an integer. An intuitive and popular method is applying the round operation: :\ y^\prime = \operatorname (y \cdot(L- 1)). However, detailed analysis results in slightly different formulation. The mapped value \ y^\prime should be 0 for the range of 0. And \ y^\prime =1 for 1/L < y \leq 2/L, \ y^\prime = 2 for 2/L < y \leq 3/L, ...., and finally \ y^\prime =L-1 for (L-1)/L < y \leq 1. Then the quantization formula from \ y to \ y^\prime should be y^\prime=\operatorname(L \cdot y)-1 . (Note: y^\prime=-1 when \ y=0 , however, it does not happen just because \ y=0 means that there is no pixel corresponding to that value.)


Of color images

The above describes histogram equalization on a grayscale 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. However, 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 In photography and image processing, color balance is the global adjustment of the intensities of the colors (typically red, green, and blue primary colors). An important goal of this adjustment is to render specific colors – particularly ne ...
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 The CIELAB color space, also referred to as ''L*a*b*'' , is a color space defined by the International Commission on Illumination (abbreviated CIE) in 1976. (Referring to CIELAB as "Lab" without asterisks should be avoided to prevent confusio ...
, or HSL/HSV color space in particular, then the algorithm can be applied to the
luminance Luminance is a photometric measure of the luminous intensity per unit area of light travelling in a given direction. It describes the amount of light that passes through, is emitted from, or is reflected from a particular area, and falls with ...
or value channel without resulting in changes to the hue and saturation of the image. There are several histogram equalization methods in 3D space. Trahanias and Venetsanopoulos applied histogram equalization in 3D color space However, it results in "whitening" where the probability of bright pixels are higher than that of dark ones. Han et al. proposed to use a new cdf defined by the iso-luminance plane, which results in uniform gray distribution.


Examples

For consistency with
statistical Statistics (from German: '' Statistik'', "description of a state, a country") is the discipline that concerns the collection, organization, analysis, interpretation, and presentation of data. In applying statistics to a scientific, industr ...
usage, "CDF" (i.e. Cumulative distribution function) should be replaced by "cumulative histogram", especially since the article links to
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Eve ...
which is derived by dividing values in the cumulative histogram by the overall amount of pixels. The equalized CDF is defined in terms of rank as rank/pixelcount.


Small image

The 8-bit grayscale 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. : The
cumulative distribution function In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x. Eve ...
(cdf) is shown below. Again, pixel values that do not contribute to an increase in the cdf are excluded for brevity. : (Please note that h(v)=\operatorname(\operatorname(v))-1 version is not illustrated yet.) 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 ,255/math>. The general histogram equalization formula is: : h(v) = \mathrm \left( \frac \times (L - 1) \right) where cdfmin is the minimum non-zero 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). ''Note that to scale values in the original data that are above 0 to the range 1 to L-1, inclusive, the above equation would instead be: : h(v) = \mathrm \left( \frac \times (L - 2) \right) + 1 where cdf(v) > 0. Scaling from 1 to 255 preserves the non-zero-ness of the minimum value.'' The equalization formula for the example scaling data from 0 to 255, inclusive, is: : h(v) = \mathrm \left( \frac \times 255 \right) 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 : h(78) = \mathrm \left( \frac \times 255 \right) = \mathrm \left( 0.714286 \times 255 \right) = 182 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. : :


Full-sized image


See also

* Histogram matching *
Adaptive histogram equalization Adaptive histogram equalization (AHE) 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 corres ...
*
Normalization (image processing) In image processing, normalization is a process that changes the range of pixel intensity values. Applications include photographs with poor contrast due to glare, for example. Normalization is sometimes called contrast stretching or histogram stre ...


Notes


References

*Acharya and Ray, ''Image Processing: Principles and Applications'', Wiley-Interscience 2005 *Russ, ''The Image Processing Handbook: Fourth Edition'', CRC 2002 {{ISBN, 0-8493-2532-3
"Histogram Equalization" at Generation5
'
archive
''


External links



Image processing