Convert from RGB to XYZ

Supported Technologies

MT, SSE2, Family10h


FwStatus   fwiRGBToXYZ_8u_C3R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToXYZ_8u_AC4R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToXYZ_16u_C3R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToXYZ_16u_AC4R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToXYZ_16s_C3R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToXYZ_16s_AC4R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToXYZ_32f_C3R ( const Fw32f * pSrcint srcStepFw32f * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToXYZ_32f_AC4R ( const Fw32f * pSrcint srcStepFw32f * pDstint dstStepFwiSize roiSize );


dstStep   Destination buffer step size (width of the buffer in bytes).
pDst   Pointer to a location in a destination buffer.
pSrc   Pointer to a location in a source buffer.
roiSize   Specifies the height and width of an ROI.
srcStep   Source buffer step size (width of the buffer in bytes).


These functions step through an ROI in a source buffer, convert the source data from the RGB color model to the XYZ color space, and write the converted data to a destination buffer.

A gamma-corrected RGB image (pSrc) declared in the ROI is converted to a CIE XYZ image (pDst).

The following formulas are used:

 X = 0.412453*R + 0.35758 *G + 0.180423*B
 Y = 0.212671*R + 0.71516 *G + 0.072169*B
 Z = 0.019334*R + 0.119193*G + 0.950227*B

The formulas assume that R, G, and B values are normalized to [0 to 1] for integer data types.

For floating point data types, the data must already be in the range [0 to 1]

For integer data types, the converted image data is saturated to [0 to 1] and scaled to the data type range

For floating point data type, data is saturated to [0 to 1].