Content deleted Content added
No edit summary |
review: you don't want to use that first option. consistent terminology. |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 25:
The ''back projection'' 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.<ref>{{cite manual|year=2001|title=Open Source Computer Vision Library Reference Manual|url=http://www.cs.unc.edu/~stc/FAQs/OpenCV/OpenCVReferenceManual.pdf|archive-url=https://web.archive.org/web/20150409155114/http://www.cs.unc.edu/~stc/FAQs/OpenCV/OpenCVReferenceManual.pdf|url-status=dead|archive-date=April 9, 2015|author=Intel Corporation|access-date=2015-01-11}}</ref
==Implementation==
Consider a discrete [[
:<math>\ p_X(i) = \frac{n_i}{n},\quad 0 \le i < L </math>
<math>L</math> being the total number of gray levels in the image
Let us then define the ''[[cumulative distribution function]]'' of pixels in image ''<math>X</math>''. For value ''<math>i</math>'' it is
Line 41:
:<math>\ T(i) = \operatorname{cdf}_X(i)</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 <math>X</math>. In order to map the values back into their original range, the following simple transformation needs to be applied to each transformed image value <math>k</math>:
:<math>\ k^\prime = k \cdot(\max(i) - \min(i)) + \min(i)= k \cdot(L- 1)</math><ref>{{web archive |url=https://web.archive.org/web/20200601000000*/https://www.math.uci.edu/icamp/courses/math77c/demos/hist_eq.pdf |title=University of California, Irvine Math 77C - Histogram Equalization}}</ref>
<math>k </math> is a real value while<math>\ k^\prime </math> has to be an integer. An intuitive and popular method<ref>{{Cite book|last=Gonzalez|first=Rafael C.
:<math>\ k^\prime = \operatorname{round} (k \cdot(L- 1))</math>.
However, detailed analysis results in slightly different formulation. The mapped value <math>k^\prime </math> should be 0 for the range of <math>0<k \leq1/L</math>. And <math>k^\prime =1</math> for <math>1/L < k \leq 2/L</math>, <math>k^\prime = 2 </math> for <math>2/L < k \leq 3/L</math>, ...., and finally <math>k^\prime =L-1</math> for <math>(L-1)/L < k \leq 1</math>. Then the quantization formula from <math>k</math> to <math>k^\prime </math> should be
Line 53 ⟶ 52:
== On color images ==
The above-described histogram equalization works on a grayscale image. It can also be used on color images. One option is applying the method separately to the red, green and blue components of the [[RGB]] color values of the image, which likely produces 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|Lab]], or [[HSL and HSV|HSL/HSV]] in particular, then the algorithm can be applied to the [[luminance]] or value channel without resulting in changes to color properties 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><!--[[User:Kvng/RTH]]-->
==Examples==
|