Content deleted Content added
No edit summary Tags: Reverted Visual edit Mobile edit Mobile web edit |
review: you don't want to use that first option. consistent terminology. |
||
(11 intermediate revisions by 7 users not shown) | |||
Line 3:
{{Use American English|date=March 2021}}
{{Use mdy dates|date=March 2021}}
[[Image:Histogrammeinebnung.png|thumb|right|300px|alt=A histogram which is zero apart from a central area containing strong peaks is transformed by stretching the peaked area to fill the entire x-axis.|Histograms of an image before and after equalization.]]
'''Histogram equalization''' is a method in [[image processing]] of [[contrast (vision)|contrast]] adjustment using the
Histogram equalization is a specific case of the more general class of histogram remapping methods.
==Overview==
This method usually increases the global
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
Histogram equalization often produces unrealistic effects in photographs; however it is very useful for scientific images like [[Thermography|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 [[List of 8-bit computer hardware palettes|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 (computing)|palette]] size, like [[Continuous function|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 (computing)|palette]] change. The operation can be expressed as
Modifications of this method use multiple histograms, called subhistograms, to emphasize local contrast
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]].<ref>{{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}}</ref>
▲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
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.<ref>{{cite
==Implementation==
Consider a discrete [[
:<math>\
<math>
Let us
:<math>\operatorname{cdf}
which is also the image's accumulated normalized histogram.
We would like to create a transformation
:<math>\operatorname{cdf}
for some constant
:<math>\
where <math>\ i </math> is in the range <math> [0,L-1] </math>. Notice that <math>\ T </math> maps the levels into the range <math>[0,1]</math>, since we used a normalized histogram of
▲Notice that <math>\ T </math> 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 [https://web.archive.org/web/20200601000000*/https://www.math.uci.edu/icamp/courses/math77c/demos/hist_eq.pdf University of California, Irvine Math 77C - Histogram Equalization].
<math>
:<math>\
However, detailed analysis results in slightly different formulation. The mapped value <math>
<math>
(Note: <math>
==
The above
There are several histogram equalization methods in 3D
▲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 and HSV|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.<ref>S. Naik and C. Murthy, "[https://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=1257395 Hue-preserving color image enhancement without gamut problem]," IEEE Trans. Image Processing, vol. 12, no. 12, pp. 1591–1598, Dec. 2003</ref>
▲There are several histogram equalization methods in 3D space. Trahanias and Venetsanopoulos applied histogram equalization in 3D color space<ref>P. E. Trahanias and A. N. Venetsanopoulos, "[https://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=202045 Color image enhancement through 3-D histogram equalization]," in Proc. 15th IAPR Int. Conf. Pattern Recognition, vol. 1, pp. 545–548, Aug.-Sep. 1992.</ref> However, it results in "whitening" where the probability of bright pixels are higher than that of dark ones.<ref>N. Bassiou and C. Kotropoulos, "[http://www.sciencedirect.com/science/article/pii/S1077314206002141 Color image histogram equalization by absolute discounting back-off]," Computer Vision and Image Understanding, vol. 107, no. 1-2, pp.108-122, Jul.-Aug. 2007</ref> Han et al. proposed to use a new cdf defined by the iso-luminance plane, which results in uniform gray distribution.<ref>{{Cite journal|doi = 10.1109/TIP.2010.2068555|title = A Novel 3-D Color Histogram Equalization Method with Uniform 1-D Gray Scale Histogram|year = 2011|last1 = Han|first1 = Ji-Hee|last2 = Yang|first2 = Sejung|last3 = Lee|first3 = Byung-Uk|journal = IEEE Transactions on Image Processing|volume = 20|issue = 2|pages = 506–512|pmid = 20801744| bibcode=2011ITIP...20..506H |s2cid = 17972519}}</ref>
==Examples==
Line 141 ⟶ 138:
|}
The histogram for this image is shown in the following table.
▲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.
:{| class="wikitable"
|-
Line 198 ⟶ 194:
|}
The [[cumulative distribution function]] (
:{| class="wikitable"
|-
! <math>v</math>, Pixel Intensity !!
|-
| 52||1||0
Line 276 ⟶ 272:
|-
| 154||64||255
|} (Please note that <math>h(v)=\operatorname{ceil}(\operatorname{
This
:<math>
Line 284 ⟶ 280:
\mathrm{round}
\left(
\frac {\operatorname{
\times (L - 1)
\right)
</math>
where
''Note that to scale values in the original data that are above 0 to the range 1 to'' <math>L-1</math>'', inclusive, the above equation would instead be:''▼
▲''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:''
:<math>
Line 298 ⟶ 293:
\mathrm{round}
\left(
\frac {\operatorname{
\times (L - 2)
\right) + 1
</math>
''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:
Line 316 ⟶ 310:
</math>
For example, the
:<math>
Line 335 ⟶ 329:
</math>
Once this is done then the values of the equalized image are directly taken from the normalized
{| class="wikitable"
Line 411 ⟶ 405:
|}
Notice that the minimum value
:{|
|