Lab color space

From Free net encyclopedia

Revision as of 06:50, 20 April 2006; view current revision
←Older revision | Newer revision→
Image:Lab color at luminance 25%.png
Image:Lab color at neutral luminance.png
Image:Lab color at luminance 75%.png

CIE L*a*b* (CIELAB) is the most complete color model used conventionally to describe all the colors visible to the human eye. It was developed for this specific purpose by the International Commission on Illumination (Commission Internationale d'Eclairage, hence its CIE initialism). The * after L, a and b are part of the full name, since they represent L*, a* and b*, derived from L, a and b.

The three parameters in the model represent the lightness of the color (L*, L*=0 yields black and L*=100 indicates white), its position between magenta and green (a*, negative values indicate green while positive values indicate magenta) and its position between yellow and blue (b*, negative values indicate blue and positive values indicate yellow).

The Lab color model has been created to serve as a device independent, absolute model to be used as a reference. Therefore it is crucial to realize that the visual representations of the full gamut of colors in this model are never accurate. They are there just to help in understanding the concept, but they are inherently inaccurate.

Since the Lab model is a three dimensional model, it can only be represented properly in a three dimensional space. A useful feature of the model however is that the first parameter is extremely intuitive: changing its value is like changing the brightness setting in a TV set. Therefore only a few representations of some horizontal "slices" in the model are enough to conceptually visualize the whole gamut, assuming that the luminance would be represented on the vertical axis.

CIE 1976 L*a*b* is based directly on the CIE 1931 XYZ color space as an attempt to linearize the perceptibility of color differences, using the color difference metric described by the MacAdam ellipse. The non-linear relations for L*, a*, and b* are intended to mimic the logarithmic response of the eye. Coloring information is referred to the color of the white point of the system, subscript n.

Contents

XYZ to CIE L*a*b* (CIELAB) and CIELAB to XYZ conversions

The forward transformation

<math>L^* = 116\,f(Y/Y_n) - 16</math>
<math>a^* = 500\,[f(X/X_n) - f(Y/Y_n)]</math>
<math>b^* = 200\,[f(Y/Y_n) - f(Z/Z_n)]</math>

where

<math>f(t) = t^{1/3}\,</math> for <math> t > 0.008856\,</math>
<math>f(t) = 7.787\,t + 16/116</math> otherwise

Here <math>X_n</math>, <math>Y_n</math> and <math>Z_n</math> are the CIE XYZ tristimulus values of the reference white point.

The division of the f(t) function into two domains was done to prevent an infinite slope at t=0. f(t) was assumed to be linear below some t=t0, and was assumed to match the t1/3 part of the function at t0 in both value and slope. In other words:

<math>t_0^{1/3}\,</math> <math>=\,</math> <math>a t_0 + b\,</math> (match in value)
<math>1/(3t_0^{2/3})\,</math> <math>=\,</math> <math>a\,</math> (match in slope)

The value of b was chosen to be 16/116. The above two equations can be solved for a and t0:

<math>a\,</math> <math>=\,</math> <math>1/(3\delta^2)\,</math> <math>= 7.787037\cdots</math>
<math>t_0\,</math> <math>=\,</math> <math>\delta^3\,</math> <math>= 0.008856\cdots</math>

where <math>\delta=6/29</math>. Note that <math>16/116=2\delta/3</math>

The reverse transformation

The reverse transformation is as follows (with <math>\delta=6/29</math> as mentioned above):

  1. define <math>f_y\equiv (L^*+16)/116</math>
  2. define <math>f_x\equiv f_y+a^*/500</math>
  3. define <math>f_z\equiv f_y-b^*/200</math>
  4. if <math>f_y > \delta\,</math> then <math>Y=Y_nf_y^3\,</math>   else <math>Y=(f_y-16/116)3\delta^2Y_n\,</math>
  5. if <math>f_x > \delta\,</math> then <math>X=X_nf_x^3\,</math>   else <math>X=(f_x-16/116)3\delta^2X_n\,</math>
  6. if <math>f_z > \delta\,</math> then <math>Z=Z_nf_z^3\,</math>   else <math>Z=(f_z-16/116)3\delta^2Z_n\,</math>

XYZ to CIELUV & CIELUV to XYZ conversions

The forward transformation

CIE 1976 L*u*v* (CIELUV) is based directly on CIE XYZ and is another attempt to linearize the perceptibility of color differences. The non-linear relations for L*, u*, and v* are given below:

<math>L^* = 116 (Y/Y_n)^{1/3} - 16\,</math>
<math>u^* = 13L^* ( u' - u_n' )\,</math>
<math>v^* = 13L^* ( v' - v_n' )\,</math>

The quantities <math>u_n'</math> and <math>v_n'</math> refer to the reference white point or the light source. (For example, for the 2° observer and illuminant C, <math>u_n' = 0.2009</math>, <math>v_n' = 0.4610</math>.) Equations for u' and v' are given below:

<math>u' = 4X / (X + 15Y + 3Z) = 4x / ( -2x + 12y + 3 )\,</math>
<math>v' = 9Y / (X + 15Y + 3Z) = 9y / ( -2x + 12y + 3 )\,</math>.

The reverse transformation

The transformation from (u',v') to (x,y) is:

<math>x = 27u' / ( 18u' - 48v' + 36 )\,</math>
<math>y = 12v' / ( 18u' - 48v' + 36 )\,</math>.

The transformation from CIELUV to XYZ is performed as following:

<math>u' = u / ( 13L^*) + u_n\,</math>
<math>v' = v / ( 13L^* ) + v_n\,</math>
<math>Y = (( L^* + 16 ) / 116 )^3\,</math>
<math>X = - 9Yu' / (( u' - 4 ) v' - u'v' )\,</math>
<math>Z = ( 9Y - 15v'Y - v'X ) / 3v'\,</math>

RGB and CMYK conversions

Programmers and others often seek a formula for conversion between RGB or CMYK values and L*a*b*, not understanding that RGB and CMYK are not absolute color spaces and so have no precise relation to an absolute color space such as L*a*b*. To convert between RGB and L*a*b*, for example, it is necessary to determine or assume an absolute color space for the RGB data, such as sRGB or Adobe RGB.de:Lab-Farbraum fr:CIE Lab nl:CIELAB pl:CIELab