Convert from RGB to YCC

Supported Technologies



FwStatus   fwiRGBToYCC_8u_C3R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYCC_8u_AC4R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYCC_16u_C3R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYCC_16u_AC4R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYCC_16s_C3R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYCC_16s_AC4R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYCC_32f_C3R ( const Fw32f * pSrcint srcStepFw32f * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYCC_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 YCC 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 Photo YCC image (pDst) in four steps.

1.  Normalize the input to the range [0 to 1] for all integer data types. Floating-point data must already be in the range [0...1].

2.  Apply the following formulas:

 Y = 0.299*R + 0.587*G + 0.114*B
 C1 = -0.299*R - 0.587*G + 0.886*B
 C2 = 0.701*R - 0.587*G - 0.114*B

3. Quantize the color model and convert to the Photo YCC model. Data is in the range [0 to 1].

 Y = (1/1.402) * Y
 C1 = (111.4/255) * C1 + 156/255
 C2 = (135.64/255) * C2 + 137/255

4. For integer destination data types, the Photo YCC color model is scaled to the full range.