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-dimensiona ...
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-dimensiona ...
's histogram.


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 Stiffness, rigid Organ (biology), organ that constitutes part of the skeleton in most vertebrate animals. Bones protect the various other organs of the body, produce red blood cell, red and white blood cells, store minerals, provid ...
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 A photograph (also known as a photo, image, or picture) is an image created by light falling on a photosensitive surface, usually photographic film or an electronic image sensor, such as a CCD or a CMOS chip. Most photographs are now created ...
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 In mathematics, the concept of an inverse element generalises the concepts of opposite () and reciprocal () of numbers. Given an operation denoted here , and an identity element denoted , if , one says that is a left inverse of , and that is ...
operator. So in theory, if the histogram equalization
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
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 es ...
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 arise ...
, while decreasing the usable
signal In signal processing, a signal is a function that conveys information about a phenomenon. Any quantity that can vary over space or time can be used as a signal to share messages between observers. The '' IEEE Transactions on Signal Processing' ...
. 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 Signal-to-noise ratio (SNR or S/N) is a measure used in science and engineering that compares the level of a desired signal to the level of background noise. SNR is defined as the ratio of signal power to the noise power, often expressed in deci ...
usually hampers visual detections. Histogram equalization often produces unrealistic effects in photographs; however it is very useful for scientific images like
thermal A thermal column (or thermal) is a rising mass of buoyant air, a convective current in the atmosphere, that transfers heat energy vertically. Thermals are created by the uneven heating of Earth's surface from solar radiation, and are an example ...
,
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 radioisotope ...
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) 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 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 ...
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 a new palette as ''P'=P(M)'' and leave image ''I'' unchanged then histogram equalization is implemented as palette 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 corr ...
, ''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 corr ...
, 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 t ...
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 (biology), order Diptera, the name being derived from the Ancient Greek, Greek δι- ''di-'' "two", and πτερόν ''pteron'' "wing". Insects of this order use only a single pair of wings to fly, the hindwing ...
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 then ...
. 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 In digital photography, computer-generated imagery, and colorimetry, a grayscale image is one in which the value of each pixel is a single sample representing only an ''amount'' of light; that is, it carries only intensity information. Gray ...
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. Ev ...
'' 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 ...
); 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 The RGB color model is an additive color model in which the red, green and blue primary colors of light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three addi ...
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, 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 withi ...
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 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. Ev ...
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 Rank is the relative position, value, worth, complexity, power, importance, authority, level, etc. of a person or object within a ranking, such as: Level or position in a hierarchical organization * Academic rank * Diplomatic rank * Hierarchy * ...
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. Ev ...
(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 The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline ...
/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 In image processing, histogram matching or histogram specification is the transformation of an image so that its histogram matches a specified histogram. The well-known histogram equalization method is a special case in which the specified histogra ...
*
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 corr ...
*
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 st ...


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