Core Optical, Inc.
ColorimetricConverter ConvertXYZtoCIELAB Method Industrial Strength, Scientific Grade
Transforms source data in-place from CIE XYZ space to CIE L*a*b* space.

Namespace: PrecisionImage.Colorimetry
Assembly: PrecisionImage (in PrecisionImage.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax

public void ConvertXYZtoCIELAB(
	SourceData dataSource,
	Illuminant whitePoint = null
)

Parameters

dataSource
Type: PrecisionImage SourceData
A SourceData object encapsulating the image data to be converted.
whitePoint (Optional)
Type: PrecisionImage.Colorimetry Illuminant
A Illuminant object specifying the reference white point used during the calculation. This parameter is optional and defaults D65.
Exceptions

Remarks

This method transforms data in CIE XYZ space to CIE L*a*b* color space, using the whitePoint illuminant as the reference white point and according to ISO standard 13655. Specifying a white point is optional. If no white point is specified a default of D65 is used. The dataSource XYZ values must be stored in channels 0, 1 and 2 respectively. L*, a* and b* output values are stored in-place in channels 0, 1 and 2. To guarantee an invertable result, output values are not clamped to any arbitrary range and are stored as-is. The dataSource object must contain at least 3 channels or an OnlineArgumentOutOfRangeException exception will result.
Examples

The following converts the image data from Linear RGB to CIE XYZ, and then from CIE XYZ to CIE L*a*b* space.
using PrecisionImage;
using PrecisionImage.Colorimetry;

// Instantiate the SourceData object. "MyBitmapSource" is an rgb image with no alpha channel: 
SourceData imageData = new SourceData(MyBitmapSource);

// Instantiate the ColorimetricConverter object: 
ColorimetricConverter colorConverter = new ColorimetricConverter();

// Image data is currently in linear RGB space. Transform to CIE XYZ in-place (imageData must have exactly 3 channels 
// or exception will result), and then from XYZ to L*a*b* (in-place) referenced to D50 illumination:
colorConverter.ConvertLinearRGBtoXYZ(imageData);
colorConverter.ConvertXYZtoCIELAB(imageData, StandardIlluminants.D50);

// Assume some processing on one or more of the L*a*b* channels:
.
.
.
// After channel processing, transform L*a*b* values back to linear RGB (in-place) 
// referenced from D50 illumination (this should be the same reference white point as the forward conversion):
colorConverter.ConvertCIELABtoXYZ(imageData, StandardIlluminants.D50);
colorConverter.ConvertXYZtoLinearRGB(imageData);
See Also