In
photography and
image processing, 'color balance' (sometimes 'gray balance', 'neutral balance', or 'white balance') refers to the adjustment of the relative amounts of red, green, and blue
primary colors in an image such that neutral colors are reproduced correctly. Color balance changes the overall mixture of colors in an image and is used for generalized
color correction.
Most electronic cameras have a means to select the type of illumination under which the photography is being done. Another option on some cameras is a button which one may press when the camera is looking at a
gray card or other neutral object, to capture a "custom" color balance. A very common option is "automatic color balance," which may be based on a scheme such as
Retinex, an
artificial neural network[Brian Funt, Vlad Cardei, and Kobus Barnard, "Learning color constancy." ''Proceedings of the Fourth IS&T/SID Color Imaging Conference,'' p 58-60 (1996).] or a
Bayesian method.
[1]
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.
[2] 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. 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 three-component 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 R=240 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.
:
where
,
, and
are the color balanced red, green, and blue components of a
pixel in the image;
,
, and
are the red, green, and blue components of the image before color balancing, and
,
, and
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.
[3]
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.
[4] 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:
:
where
,
, and
are the color-balanced tristimulus values;
,
, and
are the tristimulus values of the viewing illuminant (the white point to which the image is being transformed to conform to);
,
, and
are the tristimulus values of an object believed to be white in the un-color-balanced image, and
,
, and
are the tristimulus values of a pixel in the un-color-balanced image. If the tristimulus values of the monitor primaries are in a matrix
so that:
:
where
,
, and
are the un-
gamma corrected monitor RGB, one may use:
:
Von Kries's method
Johannes von Kries, whose theory of rods and three different color-sensitive 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" tristimulus space, representing the effective stimuli for the Long-, Medium-, and Short-wavelength 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.
[ Digital Color Imaging Handbook, Gaurav Sharma, , , CRC Press, 2003, ]
:
where
,
, and
are the color-balanced LMS cone tristimulus values;
,
, and
are the tristimulus values of an object believed to be white in the un-color-balanced image, and
,
, and
are the tristimulus values of a pixel in the un-color-balanced 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.
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. If the camera's raw RGB values are known, one may use the 3x3 diagonal matrix:
:
and then convert to a working RGB space such as sRGB or Adobe RGB after balancing.
See also
★ Color temperature
★ Gamma correction
★ White point
References
1. Graham Finlayson, Paul M Hubel, and Steven Hordley, "Color by correlation." ''Proceedings of the fifth IS&T/SID Color Imaging Conference,'' p. 6-11 (1997).
2. John A C Yule, ''Principles of Color Reproduction.'' New York: Wiley, 1967.
3. 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 323-333 (2004), retrieved online 2007-05-15 from http://www.acolyte-color.com/papers/EI_2004.pdf.
4. Mark D Fairchild, ''Color Appearance Models.'' Reading, MA: Addison-Wesley, 1998.
External links
★ Photoshop CS Tutorial listings, Color Balance, Color Selection, and more
★ Correction of color balance in photography (GPL Gimp)
★ Using Illumination Information in Color Balance Adjustments
★ Television Production Color Balancing Cameras
★ How do I adjust color balance in Photoshop?
★ PhotoNotes.org Dictionary - Colour/color balance