ColorBalance

ColorBalance[image]

adjusts the colors in image to achieve a balance that simulates the effect of neutral lighting.

ColorBalance[image,ref]

adjusts colors in image so that the reference color specified by ref is mapped to white.

ColorBalance[image,reftarget]

maps the reference color ref to target.

Details and Options

  • ColorBalance is typically used for white or gray balancing, removing unrealistic color casts from images. This usually results in representing objects with neutral colors as gray.
  • ColorBalance works with images with explicit color spaces. Images with ColorSpace->Automatic are converted to "RGB" or "Grayscale" before being adjusted.
  • Either of the ref or target can be any of the following:
  • colorexplicit color
    whitepointnamed white point as used as a setting for WhitePoint
    temperaturecolor specified by a temperature
    {temperature,tint}color specified by a temperature and a tint
    {pos1,pos2,}mean color at positions posi in the original image
    markerimagemean color sampled according to a marker image
  • The mean color above is computed in the Lab color space.
  • The temperature can be specified as a value in Kelvin, typically in the range 2000 K and 20,000 K. The tint can be given in units of , typically in the range and .
  • Temperature and tint can be visualized in the MacAdam chromaticity diagram below, where the curve corresponds to a radiating blackbody and tint adjustments are moves on isothermal lines, orthogonal to the temperature curve.
  • ColorBalance takes a Method option. Possible settings include:
  • "GrayScaling"scaling the mean of the image
    "RGBScaling"scaling in the RGB space
    "LMSScaling"scaling in the LMS space
    "ChromaticityScaling"scaling of the chromaticities in the LMS space
  • With the method "LMSScaling", the scaling is performed using the Bradford transformation matrix to convert between XYZ and LMS.
  • With a given {temperature,tint} pair, Method"ChromaticityScaling" is always used; otherwise, Method->"LMSScaling" is used.  »

Examples

open allclose all

Basic Examples  (1)

Automatic white balancing to correct for blue cast:

In[1]:=
Click for copyable input
Out[1]=

Scope  (8)

Options  (6)

Applications  (3)

Properties & Relations  (2)

Possible Issues  (1)

Interactive Examples  (1)

See Also

ImageAdjust  HistogramTransform  ImageMultiply  ColorToneMapping  BrightnessEqualize  ImageEffect  WhitePoint

Introduced in 2015
(10.2)