XYZ2LAB
Name
XYZ2LAB
Purpose
This function returns the converted CIE L*a*b* values for a
provided tristimulus value assuming a particular illuminant,
namely
L* = 116 * f( Y / Yw ) - 16
a* = 500 * [f( X / Xw ) - f( Y / Yn )]
b* = 200 * [f( Y / Yw ) - f( Z / Zn )]
where
f(x) = x^(1/3) for x > 0.008856
f(x) = 7.787 * x + 16/116 for x <= 0.008856
Category
Color Science.
Calling Sequence
Result = XYZ2LAB( xyz, ILLUMINANT=illuminant )
Inputs
xyz
A 3-element vector or 3xn array of tristimulus values
Keyword Parameters
ILLUMINANT
An optional keyword to describe the illuminant that should
be used for the XYZ to CIE L*a*b* conversion
0 - D65 (Daylight) [DEFAULT]
1 - Illuminant A (Tungsten)
2 - Illuminant F2 (Cool White Fluorescent)
3 - Illuminant F11 (Narrow Band Fluorescent)
4 - Illuminant F7 (Daylight Fluorescent)
5 - Illuminant F8 (Daylight Fluorescent)
Return Value
Result is either a 3-element vector or a 3xn array that contains
the computed CIE L*a*b* coordinates
Side Effects
None
Modification History
Written by: Carl Salvaggio
January, 2008 Original code
April, 2012 Corrected white reference scaling error
Disclaimer
This source code is provided "as is" and without warranties as to performance
or merchantability. The author and/or distributors of this source code may
have made statements about this source code. Any such statements do not
constitute warranties and shall not be relied on by the user in deciding
whether to use this source code.
This source code is provided without any express or implied warranties
whatsoever. Because of the diversity of conditions and hardware under which
this source code may be used, no warranty of fitness for a particular purpose
is offered. The user is advised to test the source code thoroughly before
relying on it. The user must assume the entire risk of using the source code.