Convert from XYZ to RGB

Supported Technologies

MT, SSE2, Family10h


FwStatus   fwiXYZToRGB_8u_C3R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiXYZToRGB_8u_AC4R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiXYZToRGB_16u_C3R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiXYZToRGB_16u_AC4R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiXYZToRGB_16s_C3R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiXYZToRGB_16s_AC4R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiXYZToRGB_32f_C3R ( const Fw32f * pSrcint srcStepFw32f * pDstint dstStepFwiSize roiSize );
FwStatus   fwiXYZToRGB_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 XYZ color space to the RGB color model, and write the converted data to a destination buffer.

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

The following formulas are used:

 R =  3.240479*R - 1.537150*G - 0.498535*B
 G = -0.969256*R + 1.875991*G + 0.041556*B
 B =  0.055648*R - 0.204043*G + 1.057311*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].