Lab color space

From Wikipedia, the free encyclopedia

Lab is the abbreviated name of two different color spaces. The best known is CIELAB (strictly CIE 1976 L*a*b*) and the other is Hunter Lab (strictly, Hunter L, a, b). Lab is an informal abbreviation, and without further checking should not be assumed to be one or the other. The color spaces are related in intention and purpose, but are different.

Both spaces are derived from the "master" space CIE 1931 XYZ color space. However, CIELAB is calculated using cube roots, and Hunter Lab is calculated using square roots.[1] Except where data must be compared with existing Hunter L,a,b values, it is recommended that CIELAB be used for new applications.[1]

The intention of both spaces is to produce a color space that is more perceptually linear than other color spaces. Perceptually linear means that a change of the same amount in a color value should produce a change of about the same visual importance. When storing colors in limited precision values, this can improve the reproduction of tones. Both Lab spaces are relative to the whitepoint of the XYZ data they were converted from. Lab values do not define absolute colors unless the whitepoint is also specified. Often, in practice, the whitepoint is assumed to follow a standard and is not explicitly stated (e.g., all ICC Lab values are relative to CIE standard illuminant D50).

Contents

[edit] Advantages of Lab

Compared to RGB and CMYK, it is often quicker to make efficient color corrections in Lab. The fact that lightness is completely disregarded in the A and B channels make these much less sensitive to errors.

Even though the number of possible numerical values for each pixel is smaller in Lab than for RGB and CMYK, it is possible to reference a much larger number of colors altogether in Lab - not only colors that cannot be described with RGB and CMYK, but also sometimes colors that do not appear at all in the real world. In some cases this access to imaginary colors is useful when one goes between several steps in the manipulation of a picture.

It would be natural to assume that one loses information converting a picture between Lab and other color spaces. However, according to tests by Dan Margulis, the loss is completely negligible. [2]

[edit] Which Lab?

Some specific uses of the abbreviation in software, literature etc.

  • In Adobe Photoshop, image editing using "Lab" is CIELAB D50.
  • In ICC Profiles, the Lab color space used as a profile connection space is CIELAB D50.
  • In TIFF files, the Lab color space is CIELAB.
  • In PDF documents, the Lab color space is CIELAB.
Lightness 25%
Lightness 25%
Lightness 50%
Lightness 50%
Lightness 75%
Lightness 75%

[edit] CIE 1976 L*, a*, b* Color Space (CIELAB)

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 asterisk (*) after L, a and b are part of the full name, since they represent L*, a* and b*, derived from L, a and b. CIELAB is an Adams Chromatic Value Space.

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 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 (3D representations of the LAB gamut).


[edit] Measuring differences

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.[3]

Uniform changes of components in the L*a*b* color model aim to correspond to uniform changes in perceived color. So the relative perceptual differences between any two colours in L*a*b* can be calculated by treating each color as a point in a three dimensional space (with three components: L*, a*, b*) and taking the euclidean distance between them.[3]

Where C_1=({L_1}^2,\ {a_1}^2,\ {b_1}^2) represent the first color coded in L*a*b* and C_2=({L_1}^2,\ {a_1}^2,\ {b_1}^2) represents the second color coded in L*a*b*:

difference(C_1,C_2)=\sqrt{ ({L_2}^*-{L_1}^*)^2+({a_2}^*-{a_1}^*)^2 + ({b_2}^*-{b_1}^*)^2 }\,

The size of the differences is related to those in the Munsell book of color.

Another related color space is L*u*v* which follows the same principles as L*a*b* but has a different representation of the u* and v* components (preserving the same L*). L*u*v* color differences present different values, smaller than those of the Munsell book of color.[3]

[edit] 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 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. For each of these absolute spaces, there are standard techniques for converting to and from the XYZ absolute color space (see for example SRGB color space#Specification of the transformation) which can be combined with the following transformations to convert them to L*a*b*.

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

[edit] The forward transformation

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

where

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

Here Xn, Yn and Zn 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:

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

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

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

where δ = 6 / 29. Note that 16 / 116 = 2δ / 3

[edit] The reverse transformation

The reverse transformation is as follows (with δ = 6 / 29 as mentioned above):

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

[edit] XYZ to CIELUV & CIELUV to XYZ conversions

[edit] The forward transformation

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

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

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

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

[edit] The reverse transformation

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

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

The transformation from CIELUV to XYZ is performed as following:

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

[edit] Hunter Lab Color Space

L is a correlate of Lightness, and is computed from the Y tristimulus value using Priest's Approximation to Munsell Value:

L=100\sqrt{Y/Yn}

where Yn is the Y tristimulus value of a specified white object. For surface-color applications, the specified white object is usually (though not always) a hypothetical material with unit reflectance and which follows Lambert's law. The result will be Ls scaled between 0 (black) and 100 (white); roughly 10 times Munsell value. Note, however, that a mid-range Lightness of 50 is produced not by a Y of 50, but rather of 25.

a and b are termed opponent color axes. a represents, roughly, Redness (positive) versus Greenness (negative), and is computed:

a=K_a\left(\frac{X/X_n-Y/Y_n}{\sqrt{Y/Y_n}}\right)

where Ka is a coefficient which depends upon the illuminant (for D65, Ka is 172.30; see approximate formula below) and Xn is the X tristimulus value of the specified white object.

The other opponent color axis, b, is positive for yellow colors and negative for blue colors. It is computed as:

b=K_b\left(\frac{Y/Yn-Z/Zn}{\sqrt{Y/Yn}}\right)

where Kb is a coefficient which depends upon the illuminant (for D65, Kb is 67.20; see approximate formula below) and Zn is the Z tristimulus value of the specified white object.[4]

Both a and b will be zero for objects which have the same chromaticity coordinates as the specified white objects. Usually this is the case for neutrals.

[edit] Approximate Formulas for Ka and Kb

In the previous version of the Hunter Lab color space, Ka was 175 and Kb was 70. Apparently, Hunter Associates Lab discovered that better agreement could be obtained with other color difference metrics, such as CIELAB (see below) by allowing these coefficients to depend upon the illuminants. Approximate formulae are:

K_a\approx\frac{175}{198.04}(X_n+Y_n)

K_b\approx\frac{70}{218.11}(Y_n+Z_n)

which result in the original values for Illuminant C, the original illuminant with which the Lab color space was used.

[edit] The Hunter Lab Color Space as an Adams Chromatic Valance Space

Adams Chromatic Valance spaces are based on two elements: a (relatively) uniform lightness scale, and a (relatively) uniform chromaticity diagram.[5] If we take as the uniform lightness scale Priest's approximation to the Munsell Value scale, which would be written in modern notation:

L=100\sqrt{Y/Yn}

and, as the uniform chromaticity coordinates:

c_a=\frac{X/Xn}{Y/Yn}-1=\frac{X/Xn-Y/Yn}{Y/Yn}

c_b=k_e\left(1-\frac{Z/Zn}{Y/Yn}\right)=k_e\frac{Y/Yn-Z/Zn}{Y/Yn}

where ke is a tuning coefficient, we obtain the two chromatic axes:

a=K\cdot L\cdot c_a=K\cdot 100\sqrt{Y/Yn}\frac{X/Xn-Y/Yn}{Y/Yn}=K\cdot 100\frac{X/Xn-Y/Yn}{\sqrt{Y/Yn}}

and

b=K\cdot L\cdot c_b=K\cdot k_e\cdot 100\sqrt{Y/Yn}\frac{Y/Yn-Z/Zn}{Y/Yn}=K\cdot k_e\cdot 100\frac{Y/Yn-Z/Zn}{\sqrt{Y/Yn}}

which is identical to the Hunter Lab formulae given above if we select K = Ka / 100 and ke = Kb / Ka. Therefore, the Hunter Lab color space is an Adams Chromatic Valance space.

[edit] References

  1. ^ a b Hunter L,a,b Versus CIE 1976 L*a*b* (PDF)
  2. ^ Dan Margulis. Photoshop Lab Color: The Canyon Conundrum and Other Adventures in the Most Powerful Colorspace, ISBN 0321356780. 
  3. ^ a b c "Anil K. Jain" (1989). "Fundamentals of Digital Image Processing". New Jersey, United States of America: Prentince-Hall Inc., p. 68, 71, 73. ISBN 0-13-336165-9. 
  4. ^ Hunter Labs (1996). "Hunter Lab Color Scale". Insight on Color 8 9 (August 1-15, 1996). Reston, VA, USA: Hunter Associates Laboratories.
  5. ^ Adams, E. Q. (1942). "X-Z planes in the 1931 I.C.I. system of colorimetry". JOSA 32 3: 168-173.