Core Optical, Inc.
ColorimetricConverter ApplyXYZChromaticAdaptation Method Industrial Strength, Scientific Grade
Applies a chromatic adaptation transform in-place between two specified illuminants.

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

public void ApplyXYZChromaticAdaptation(
	SourceData dataSource,
	Illuminant currentWhitePoint,
	Illuminant targetWhitePoint,
	ChromaticAdaptationModels adaptationModel = ChromaticAdaptationModels.LinearBradford
)
Remarks

This method is used to perform a chromatic adaptation transform on CIE XYZ data. The XYZ values must be contained in channels 0, 1 and 2 respectively. Output XYZ values are stored in-place in channels 0, 1 and 2 respectively. currentWhitePoint is an Illuminant object specifying the illuminant from which the data is being transformed from. targetWhitePoint is an Illuminant object to which the data is being chromatically adapted to. The type of adaptation model to apply is specified via the ChromaticAdaptationModels enumeration. To guarantee an invertable result, output values are not clamped to any arbitrary range and are stored as-is.
Examples

The following converts the image data from Linear RGB to CIE XYZ, applies the CIECAT02 chromatic adaptation model to adapt from D65 to F2 (Cool White Fluorescent) white points, then back to linear RGB.
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 D65 XYZ to F2 XYZ:
colorConverter.ConvertLinearRGBtoXYZ(imageData);
colorConverter.ApplyXYZChromaticAdaptation(imageData, StandardIlluminants.D65, StandardIlluminants.F2, ChromaticAdaptationModels.CIECAT02);


// Assume some processing on one or more of the F2-referenced XYZ channels:
.
.
.
// After channel processing, transform F2 XYZ values back to linear RGB (in-place):
colorConverter.ApplyXYZChromaticAdaptation(imageData, StandardIlluminants.F2, StandardIlluminants.D65, ChromaticAdaptationModels.CIECAT02);
colorConverter.ConvertXYZtoLinearRGB(imageData);
See Also