Frequent Links
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 neutral colors – correctly; hence, the general method is sometimes called gray balance, neutral balance, or white balance. Color balance changes the overall mixture of colors in an image and is used for color correction; generalized versions of color balance are used to get colors other than neutrals to also appear correct or pleasing.
Image data acquired by sensors – either film or electronic image sensors – must be transformed from the acquired values to new values that are appropriate for color reproduction or display. Several aspects of the acquisition and display process make such color correction essential – including the fact that the acquisition sensors do not match the sensors in the human eye, that the properties of the display medium must be accounted for, and that the ambient viewing conditions of the acquisition differ from the display viewing conditions.
The color balance operations in popular image editing applications usually operate directly on the red, green, and blue channel pixel values,^{[1]}^{[2]} without respect to any color sensing or reproduction model. In shooting film, color balance is typically achieved by using color correction filters over the lights or on the camera lens.^{[3]}
Contents
Generalized color balance
Sometimes the adjustment to keep neutrals neutral is called white balance, and the phrase color balance refers to the adjustment that in addition makes other colors in a displayed image appear to have the same general appearance as the colors in an original scene.^{[4]} It is particularly important that neutral (gray, neutral, white) colors in a scene appear neutral in the reproduction. Hence, the special case of balancing the neutral colors (sometimes gray balance, neutral balance, or white balance) is a particularly important – perhaps dominant – element of color balancing.
Normally, one would not use the phrase color balance to describe the adjustments needed to account for differences between the sensors and the human eye, or the details of the display primaries. Color balance is normally reserved to refer to correction for differences in the ambient illumination conditions. However, the algorithms for transforming the data do not always clearly separate out the different elements of the correction. Hence, it can be difficult to assign color balance to a specific step in the color correction process. Moreover, there can be significant differences in the color balancing goal. Some applications are created to produce an accurate rendering – as suggested above. In other applications, the goal of color balancing is to produce a pleasing rendering. This difference also creates difficulty in defining the color balancing processing operations.
Illuminant estimation and adaptation
Most digital cameras have a means to select a color correction based on the type of scene illumination, using either manual illuminant selection, or automatic white balance (AWB), or custom white balance. The algorithm that performs this analysis performs generalized color balancing, known as illuminant adaptation or chromatic adaptation.
Many methods are used to achieve color balancing. Setting a button on a camera is a way for the user to indicate to the processor the nature of the scene lighting. Another option on some cameras is a button which one may press when the camera is pointed at a gray card or other neutral object. This "custom white balance" step captures an image of the ambient light, and this information is helpful in controlling color balance.
There is a large literature on how one might estimate the ambient illumination from the camera data and then use this information to transform the image data. A variety of algorithms have been proposed, and the quality of these have been debated. A few examples and examination of the references therein will lead the reader to many others. Examples are Retinex, an artificial neural network^{[5]} or a Bayesian method.^{[6]}
Color balance and chromatic colors
Color balancing an image affects not only the neutrals, but other colors as well. An image that is not color balanced is said to have a color cast, as everything in the image appears to have been shifted towards one color or another.^{[7]}^{[page needed]} Color balancing may be thought in terms of removing this color cast.
Color balance is also related to color constancy. Algorithms and techniques used to attain color constancy are frequently used for color balancing, as well. Color constancy is, in turn, related to chromatic adaptation. Conceptually, color balancing consists of two steps: first, determining the illuminant under which an image was captured; and second, scaling the components (e.g., R, G, and B) of the image or otherwise transforming the components so they conform to the viewing illuminant.
Viggiano found that white balancing in the camera's native RGB tended to produce less color inconstancy (i.e., less distortion of the colors) than in monitor RGB for over 4000 hypothetical sets of camera sensitivities.^{[8]} This difference typically amounted to a factor of more than two in favor of camera RGB. This means that it is advantageous to get color balance right at the time an image is captured, rather than edit later on a monitor. If one must color balance later, balancing the raw image data will tend to produce less distortion of chromatic colors than balancing in monitor RGB.
Mathematics of color balance
Color balancing is sometimes performed on a threecomponent image (e.g., RGB) using a 3x3 matrix. This type of transformation is appropriate if the image were captured using the wrong white balance setting on a digital camera, or through a color filter.
Scaling monitor R, G, and B
In principle, one wants to scale all relative luminances in an image so that objects which are believed to be neutral appear so. If, say, a surface with <math>R=240</math> was believed to be a white object, and if 255 is the count which corresponds to white, one could multiply all red values by 255/240. Doing analogously for green and blue would result, at least in theory, in a color balanced image. In this type of transformation the 3x3 matrix is a diagonal matrix.
 <math>\left[\begin{array}{c} R \\ G \\ B \end{array}\right]=\left[\begin{array}{ccc}255/R'_w & 0 & 0 \\ 0 & 255/G'_w & 0 \\ 0 & 0 & 255/B'_w\end{array}\right]\left[\begin{array}{c}R' \\ G' \\ B' \end{array}\right]</math>
where <math>R</math>, <math>G</math>, and <math>B</math> are the color balanced red, green, and blue components of a pixel in the image; <math>R'</math>, <math>G'</math>, and <math>B'</math> are the red, green, and blue components of the image before color balancing, and <math>R'_w</math>, <math>G'_w</math>, and <math>B'_w</math> are the red, green, and blue components of a pixel which is believed to be a white surface in the image before color balancing. This is a simple scaling of the red, green, and blue channels, and is why color balance tools in Photoshop and the GIMP have a white eyedropper tool. It has been demonstrated that performing the white balancing in the phosphor set assumed by sRGB tends to produce large errors in chromatic colors, even though it can render the neutral surfaces perfectly neutral.^{[8]}
Scaling X, Y, Z
If the image may be transformed into CIE XYZ tristimulus values, the color balancing may be performed there. This has been termed a “wrong von Kries” transformation.^{[9]}^{[10]} Although it has been demonstrated to offer usually poorer results than balancing in monitor RGB, it is mentioned here as a bridge to other things. Mathematically, one computes:
 <math>\left[\begin{array}{c} X \\ Y \\ Z \end{array}\right]=\left[\begin{array}{ccc}X_w/X'_w & 0 & 0 \\ 0 & Y_w/Y'_w & 0 \\ 0 & 0 & Z_w/Z'_w\end{array}\right]\left[\begin{array}{c}X' \\ Y' \\ Z' \end{array}\right]</math>
where <math>X</math>, <math>Y</math>, and <math>Z</math> are the colorbalanced tristimulus values; <math>X_w</math>, <math>Y_w</math>, and <math>Z_w</math> are the tristimulus values of the viewing illuminant (the white point to which the image is being transformed to conform to); <math>X'_w</math>, <math>Y'_w</math>, and <math>Z'_w</math> are the tristimulus values of an object believed to be white in the uncolorbalanced image, and <math>X'</math>, <math>Y'</math>, and <math>Z'</math> are the tristimulus values of a pixel in the uncolorbalanced image. If the tristimulus values of the monitor primaries are in a matrix <math>\mathbf{P}</math> so that:
 <math>\left[\begin{array}{c} X \\ Y \\ Z \end{array}\right]=\mathbf{P}\left[\begin{array}{c}L_R \\ L_G \\ L_B \end{array}\right]</math>
where <math>L_R</math>, <math>L_G</math>, and <math>L_B</math> are the ungamma corrected monitor RGB, one may use:
 <math>\left[\begin{array}{c} L_R \\ L_G \\ L_B \end{array}\right]=\mathbf{P^{1}}\left[\begin{array}{ccc}X_w/X'_w & 0 & 0 \\ 0 & Y_w/Y'_w & 0 \\ 0 & 0 & Z_w/Z'_w\end{array}\right]\mathbf{P}\left[\begin{array}{c}L_{R'} \\ L_{G'} \\ L_{B'} \end{array}\right]</math>
Von Kries's method
Johannes von Kries, whose theory of rods and three colorsensitive cone types in the retina has survived as the dominant explanation of color sensation for over 100 years, motivated the method of converting color to the LMS color space, representing the effective stimuli for the Long, Medium, and Shortwavelength cone types that are modeled as adapting independently. A 3x3 matrix converts RGB or XYZ to LMS, and then the three LMS primary values are scaled to balance the neutral; the color can then be converted back to the desired final color space:^{[11]}
 <math>\left[\begin{array}{c} L \\ M \\ S \end{array}\right]=\left[\begin{array}{ccc}1/L'_w & 0 & 0 \\ 0 & 1/M'_w & 0 \\ 0 & 0 & 1/S'_w\end{array}\right]\left[\begin{array}{c}L' \\ M' \\ S' \end{array}\right]</math>
where <math>L</math>, <math>M</math>, and <math>S</math> are the colorbalanced LMS cone tristimulus values; <math>L'_w</math>, <math>M'_w</math>, and <math>S'_w</math> are the tristimulus values of an object believed to be white in the uncolorbalanced image, and <math>L'</math>, <math>M'</math>, and <math>S'</math> are the tristimulus values of a pixel in the uncolorbalanced image.
Matrices to convert to LMS space were not specified by von Kries, but can be derived from CIE color matching functions and LMS color matching functions when the latter are specified; matrices can also be found in reference books.^{[11]}
Scaling camera RGB
By Viggiano's measure, and using his model of gaussian camera spectral sensitivities, most camera RGB spaces performed better than either monitor RGB or XYZ.^{[8]} If the camera's raw RGB values are known, one may use the 3x3 diagonal matrix:
 <math>\left[\begin{array}{c} R \\ G \\ B \end{array}\right]=\left[\begin{array}{ccc}255/R'_w & 0 & 0 \\ 0 & 255/G'_w & 0 \\ 0 & 0 & 255/B'_w\end{array}\right]\left[\begin{array}{c}R' \\ G' \\ B' \end{array}\right]</math>
and then convert to a working RGB space such as sRGB or Adobe RGB after balancing.
Preferred chromatic adaptation spaces
Comparisons of images balanced by diagonal transforms in a number of different RGB spaces have identified several such spaces that work better than others, and better than camera or monitor spaces, for chromatic adaptation, as measured by several color appearance models; the systems that performed statistically as well as the best on the majority of the image test sets used were the "Sharp", "Bradford", "CMCCAT", and "ROMM" spaces.^{[12]}
General illuminant adaptation
The best color matrix for adapting to a change in illuminant is not necessarily a diagonal matrix in a fixed color space. It has long been known that if the space of illuminants can be described as a linear model with N basis terms, the proper color transformation will be the weighted sum of N fixed linear transformations, not necessarily consistently diagonalizable.^{[13]}
See also
References
 ^ Phyllis Davis (2000). The Gimp for Linux and Unix. Peachpit Press. p. 134. ISBN 0201702533.
 ^ Adobe Creative Team (2000). Adobe Photoshop 6.0. Adobe Press. p. 278. ISBN 0201710161.
 ^ Blain Brown (2002). Cinematography: Theory and Practice : Imagemaking for Cinematographers, Directors, and Videographers. Focal Press. p. 170. ISBN 0240805003.
 ^ HsienChe Lee (2005). Introduction to Color Imaging Science. Cambridge University Press. p. 450. ISBN 052184388X.
 ^ Brian Funt, Vlad Cardei, and Kobus Barnard, "Learning color constancy," in Proceedings of the Fourth IS&T/SID Color Imaging Conference, p 5860 (1996).
 ^ Graham Finlayson, Paul M. Hubel, and Steven Hordley (November 2001). "Color by correlation: a simple, unifying framework for color constancy" (PDF). IEEE Transactions on Pattern Analysis and Machine Intelligence 23 (11): 1209–1221. doi:10.1109/34.969113.
 ^ John A C Yule, Principles of Color Reproduction. New York: Wiley, 1967.
 ^ ^{a} ^{b} ^{c} J A Stephen Viggiano, "Comparison of the accuracy of different white balancing options as quantified by their color constancy." Sensors and Camera Systems for Scientific, Industrial, and Digital Photography Applications V: Proceedings of the SPIE, volume 5301. Bellingham, WA: SPIE: the International Society for Optical Engineering, p 323333 (2004), retrieved online 20080728.
 ^ Heinz Terstiege (1972). "Chromatic adaptation: a stateoftheart report". Journal of Color Appearance 1 (4): 19–23 (cont. 40).
 ^ Mark D Fairchild, Color Appearance Models. Reading, MA: AddisonWesley, 1998.
 ^ ^{a} ^{b} Gaurav Sharma (2003). Digital Color Imaging Handbook. CRC Press. p. 153. ISBN 084930900X.
 ^ Sabine Süsstrunk, Jack Holm, and Graham D. Finlayson (January 2001). "Chromatic Adaptation Performance of Different RGB Sensors". IS&T/SPIE Electronic Imaging 4300.
 ^ Laurence T. Maloney and Brain A. Wandell (1987). "Color constancy: a method for recovering surface spectral reflectance". In Martin A. Fischler and Oscar Firschein. Readings in Computer Vision. MorganKaufmann. ISBN 0934613338.
External links
 White Balance  Intro at nikondigital.org
 Understanding White Balance  Tutorial
 Affine color balance with saturation, with code and online demonstration
 Getting the White Balance Right for Neutral Colors  Photography Tutorial
