Convert from YCC to RGB

Supported Technologies



FwStatus   fwiYCCToRGB_8u_C3R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiYCCToRGB_8u_AC4R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiYCCToRGB_16u_C3R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiYCCToRGB_16u_AC4R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiYCCToRGB_16s_C3R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiYCCToRGB_16s_AC4R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiYCCToRGB_32f_C3R ( const Fw32f * pSrcint srcStepFw32f * pDstint dstStepFwiSize roiSize );
FwStatus   fwiYCCToRGB_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 YCC color space to the RGB color model, and write the converted data to a destination buffer.

A Photo YCC image (pSrc) declared in the ROI is converted to a gamma-corrected RGB image (pDst) as follows.

Restore normal YCC data:

 Y = 1.3584 * Y
 C1 = 2.2179 * (C1 - 156/255)
 C2 = 1.8215 * (C2 - 137/255)

 The formulas assume that Y, C1, and C2 are normalized to [0 to 1].
 For floating point data type, the input must already be in the range [0 to 1].
 For integer data types, an internal conversion is performed, then the restored YCC data is transformed to RGB.

The following conversion formulas are used:

 R = Y + C2
 G = Y - 0.194*C1 - 0.509*C2
 B = Y + C1

 For integer destination data types, the result image data is scaled to the full range of the destination data type.