


Compute CIE chromaticity (xy) coordinates from XYZ data
xy = chromaticity( XYZ)
Purpose:
The input (XYZ) data can be in XW (space-wavelength) or RGB format.
In XW format, we expect N rows corresponding to spatial positions and
three columns containing in X,Y and Z. The chromaticity coordinates
(x,y) are returned in the columns of an Nx2 matrix.
If the data are in RGB format, the three planes should be (X,Y,Z) images. The
returned data are in as a two dimensional image format, with each
spatial position containing the corresponding (x,y) value.
This routine can be (ab)used to calculate rg coordinates from RGB values.
Examples:
patchSize = 1;
macbethChart = sceneCreate('macbeth',patchSize);
p = sceneGet(macbethChart,'photons'); wave = sceneGet(macbethChart,'wave');
e = Quanta2Energy(wave,p);
XYZ = ieXYZFromEnergy(e,wave);
chromaticity(XYZ)
XYZ = XW2RGBFormat(XYZ,4,6);
chromaticity(XYZ)
Copyright ImagEval Consultants, LLC, 2003.