Home > ISET > color > vcXYZ2lab.m

vcXYZ2lab

PURPOSE ^

Convert CIE XYZ values to CIE LAB values

SYNOPSIS ^

function lab = vcXYZ2lab(xyz, whitepoint, useOldCode)

DESCRIPTION ^

 Convert CIE XYZ values to CIE LAB values

    lab = vcXYZ2lab(xyz, whitepoint, flag)

 Convert CIE XYZ into CIE L*a*b*.  The CIELAB values are used for color
 metric calculations, such as deltaE2000.  The formula for XYZ to CIELAB
 require knowledge of the XYZ white point as well.

 XYZ can be in either XW or RGB format.
 WHITEPOINT: a 3-vector of the xyz values of the white point.

 CIELAB values are returned in the same format (RGB or XW) as the input
 XYZ. 

 Read about CIELAB formulae in Wyszecki and Stiles, page 167 and other standard texts.

 The Matlab image toolbox routines makecform and applycform have CIELAB
 transforms.  These are not the default, however, because they are not
 in all versions.  Instead, we default to the code we used for many
 years.  But by setting useOldCode = 0, you get the Matlab
 implementation.

 For a (very small) problem with the official formula, see
 http://www.brucelindbloom.com/index.html?LContinuity.html

 Examples:
  vci = vcGetObject('vcimage');
  [locs,rgb] = ieMacbethSelect(vci); 
  dataXYZ = imageRGB2xyz(vci,rgb);
  whiteXYZ = dataXYZ(1,:);
  lab = vcXYZ2lab(dataXYZ,whiteXYZ);

 Copyright ImagEval Consultants, LLC, 2003.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Thu 20-Nov-2008 22:09:04 by m2html © 2003