Histogram equalization is a method in image processing of contrast adjustment using the image's histogram.
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 structure in x-ray 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 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 detections.
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 to which one would apply false-color. 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 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, contrast limiting adaptive histogram equalization or CLAHE, 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. [1]
A signal transform equivalent to histogram equalization also seems to happen 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. [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)
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. [3]
Consider a discrete grayscale image {x} 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
being the total number of gray levels in the image (typically 256), n being the total number of pixels in the image, and being in fact the image's histogram for pixel value i, normalized to [0,1].
Let us also define the cumulative distribution function corresponding to i as
which is also the image's accumulated normalized histogram.
We would like to create a transformation of the form to produce a new image {y}, with a flat histogram. Such an image would have a linearized cumulative distribution function (CDF) across the value range, i.e.
for some constant . The properties of the CDF allow us to perform such a transform (see Inverse distribution function); it is defined as
where is in the range . Notice that maps the levels into the range [0,1], since we used a normalized histogram of {x}. In order to map the values back into their original range, the following simple transformation needs to be applied on the result:
A more detailed derivation is provided in University of California, Irvine Math 77C - Histogram Equalization.
is a real value while has to be an integer. An intuitive and popular method [4] is applying the round operation:
However, detailed analysis results in slightly different formulation. The mapped value should be 0 for the range of . And for , for , ...., and finally for . Then the quantization formula from to should be
.
(Note: when , however, it does not happen just because means that there is no pixel corresponding to that value.)
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 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. [5] There are several histogram equalization methods in 3D space. Trahanias and Venetsanopoulos applied histogram equalization in 3D color space [6] However, it results in "whitening" where the probability of bright pixels are higher than that of dark ones. [7] Han et al. proposed to use a new cdf defined by the iso-luminance plane, which results in uniform gray distribution. [8]
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 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 .
The 8-bit grayscale image shown has the following values:
52 | 55 | 61 | 59 | 79 | 61 | 76 | 61 |
---|---|---|---|---|---|---|---|
62 | 59 | 55 | 104 | 94 | 85 | 59 | 71 |
63 | 65 | 66 | 113 | 144 | 104 | 63 | 72 |
64 | 70 | 70 | 126 | 154 | 109 | 71 | 69 |
67 | 73 | 68 | 106 | 122 | 88 | 68 | 68 |
68 | 79 | 60 | 70 | 77 | 66 | 58 | 75 |
69 | 85 | 64 | 58 | 55 | 61 | 65 | 83 |
70 | 87 | 69 | 68 | 65 | 73 | 78 | 90 |
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 in the cdf are excluded for brevity.
v, Pixel Intensity | cdf(v) | h(v), Equalized v |
---|---|---|
52 | 1 | 0 |
55 | 4 | 12 |
58 | 6 | 20 |
59 | 9 | 32 |
60 | 10 | 36 |
61 | 14 | 53 |
62 | 15 | 57 |
63 | 17 | 65 |
64 | 19 | 73 |
65 | 22 | 85 |
66 | 24 | 93 |
67 | 25 | 97 |
68 | 30 | 117 |
69 | 33 | 130 |
70 | 37 | 146 |
71 | 39 | 154 |
72 | 40 | 158 |
73 | 42 | 166 |
75 | 43 | 170 |
76 | 44 | 174 |
77 | 45 | 178 |
78 | 46 | 182 |
79 | 48 | 190 |
83 | 49 | 194 |
85 | 51 | 202 |
87 | 52 | 206 |
88 | 53 | 210 |
90 | 54 | 215 |
94 | 55 | 219 |
104 | 57 | 227 |
106 | 58 | 231 |
109 | 59 | 235 |
113 | 60 | 239 |
122 | 61 | 243 |
126 | 62 | 247 |
144 | 63 | 251 |
154 | 64 | 255 |
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 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:
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:
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:
0 | 12 | 53 | 32 | 190 | 53 | 174 | 53 |
---|---|---|---|---|---|---|---|
57 | 32 | 12 | 227 | 219 | 202 | 32 | 154 |
65 | 85 | 93 | 239 | 251 | 227 | 65 | 158 |
73 | 146 | 146 | 247 | 255 | 235 | 154 | 130 |
97 | 166 | 117 | 231 | 243 | 210 | 117 | 117 |
117 | 190 | 36 | 146 | 178 | 93 | 20 | 170 |
130 | 202 | 73 | 20 | 12 | 53 | 85 | 194 |
146 | 206 | 130 | 117 | 85 | 166 | 182 | 215 |
Notice that the minimum value (52) is now 0 and the maximum value (154) is now 255.
In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable , or just distribution function of , evaluated at , is the probability that will take a value less than or equal to .
A histogram is a visual representation of the distribution of quantitative data. To construct a histogram, the first step is to "bin" the range of values— divide the entire range of values into a series of intervals—and then count how many values fall into each interval. The bins are usually specified as consecutive, non-overlapping intervals of a variable. The bins (intervals) are adjacent and are typically of equal size.
A random variable is a mathematical formalization of a quantity or object which depends on random events. The term 'random variable' in its mathematical definition refers to neither randomness nor variability but instead is a mathematical function in which
In statistics, the kth order statistic of a statistical sample is equal to its kth-smallest value. Together with rank statistics, order statistics are among the most fundamental tools in non-parametric statistics and inference.
HSL and HSV are the two most common cylindrical-coordinate representations of points in an RGB color model. The two representations rearrange the geometry of RGB in an attempt to be more intuitive and perceptually relevant than the cartesian (cube) representation. Developed in the 1970s for computer graphics applications, HSL and HSV are used today in color pickers, in image editing software, and less commonly in image analysis and computer vision.
In image processing and photography, a color histogram is a representation of the distribution of colors in an image. For digital images, a color histogram represents the number of pixels that have colors in each of a fixed list of color ranges, that span the image's color space, the set of all possible colors.
In digital image processing and computer vision, image segmentation is the process of partitioning a digital image into multiple image segments, also known as image regions or image objects. The goal of segmentation is to simplify and/or change the representation of an image into something that is more meaningful and easier to analyze. Image segmentation is typically used to locate objects and boundaries in images. More precisely, image segmentation is the process of assigning a label to every pixel in an image such that pixels with the same label share certain characteristics.
In probability theory and statistics, the generalized extreme value (GEV) distribution is a family of continuous probability distributions developed within extreme value theory to combine the Gumbel, Fréchet and Weibull families also known as type I, II and III extreme value distributions. By the extreme value theorem the GEV distribution is the only possible limit distribution of properly normalized maxima of a sequence of independent and identically distributed random variables. that a limit distribution needs to exist, which requires regularity conditions on the tail of the distribution. Despite this, the GEV distribution is often used as an approximation to model the maxima of long (finite) sequences of random variables.
In probability theory and statistics, the continuous uniform distributions or rectangular distributions are a family of symmetric probability distributions. Such a distribution describes an experiment where there is an arbitrary outcome that lies between certain bounds. The bounds are defined by the parameters, and which are the minimum and maximum values. The interval can either be closed or open. Therefore, the distribution is often abbreviated where stands for uniform distribution. The difference between the bounds defines the interval length; all intervals of the same length on the distribution's support are equally probable. It is the maximum entropy probability distribution for a random variable under no constraint other than that it is contained in the distribution's support.
Optical resolution describes the ability of an imaging system to resolve detail, in the object that is being imaged. An imaging system may have many individual components, including one or more lenses, and/or recording and display components. Each of these contributes to the optical resolution of the system; the environment in which the imaging is done often is a further important factor.
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 stretching. In more general fields of data processing, such as digital signal processing, it is referred to as dynamic range expansion.
The optical transfer function (OTF) of an optical system such as a camera, microscope, human eye, or projector specifies how different spatial frequencies are captured or transmitted. It is used by optical engineers to describe how the optics project light from the object or scene onto a photographic film, detector array, retina, screen, or simply the next item in the optical transmission chain. A variant, the modulation transfer function (MTF), neglects phase effects, but is equivalent to the OTF in many situations.
The root mean square deviation (RMSD) or root mean square error (RMSE) is either one of two closely related and frequently used measures of the differences between true or predicted values on the one hand and observed values or an estimator on the other. The deviation is typically simply a differences of scalars; it can also be generalized to the vector lengths of a displacement, as in the bioinformatics concept of root mean square deviation of atomic positions.
Ordered dithering is any image dithering algorithm which uses a pre-set threshold map tiled across an image. It is commonly used to display a continuous image on a display of smaller color depth. For example, Microsoft Windows uses it in 16-color graphics modes. The algorithm is characterized by noticeable crosshatch patterns in the result.
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 corresponding to a distinct section of the image, and uses them to redistribute the lightness values of the image. It is therefore suitable for improving the local contrast and enhancing the definitions of edges in each region of an image.
A summed-area table is a data structure and algorithm for quickly and efficiently generating the sum of values in a rectangular subset of a grid. In the image processing domain, it is also known as an integral image. It was introduced to computer graphics in 1984 by Frank Crow for use with mipmaps. In computer vision it was popularized by Lewis and then given the name "integral image" and prominently used within the Viola–Jones object detection framework in 2001. Historically, this principle is very well known in the study of multi-dimensional probability distribution functions, namely in computing 2D probabilities from the respective cumulative distribution functions.
Computer stereo vision is the extraction of 3D information from digital images, such as those obtained by a CCD camera. By comparing information about a scene from two vantage points, 3D information can be extracted by examining the relative positions of objects in the two panels. This is similar to the biological process of stereopsis.
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 histogram is uniformly distributed.
Color normalization is a topic in computer vision concerned with artificial color vision and object recognition. In general, the distribution of color values in an image depends on the illumination, which may vary depending on lighting conditions, cameras, and other factors. Color normalization allows for object recognition techniques based on color to compensate for these variations.
There are many programs and algorithms used to plot the Mandelbrot set and other fractals, some of which are described in fractal-generating software. These programs use a variety of algorithms to determine the color of individual pixels efficiently.
{{cite journal}}
: Cite journal requires |journal=
(help)