CIELAB color space
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 the CIE acronym in its name). 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 luminance of the color (L, the smallest L yields black), its position between red and green (a, the smallest a yields green) and its position between green and blue (b, the smallest b yields blue).
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.
An important thing to remember about the Lab model is the fact that it's inherently parametrized correctly, therefore no specific color spaces based on this model are needed.
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.
XYZ to CIE L*a*b* (CIELAB) and CIELAB to XYZ conversions
The forward transformation
where
- for
- otherwise
Here , and 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:
(match in value) (match in slope)
The value of b was chosen to be 16/116. The above two equations can be solved for a and t0:
where . Note that
The reverse transformation
The reverse transformation is as follows (with as mentioned above):
- define
- define
- define
- if then else
- if then else
- if then else
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:
The quantities and refer to the reference white point or the light source. (For example, for the 2° observer and illuminant C, , .) Equations for u' and v' are given below:
- .
The reverse transformation
The transformation from (u',v') to (x,y) is:
- .
The transformation from CIELUV to XYZ is performed as following:
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.