RGBToLUV

Convert from RGB to LUV

Supported Technologies

MT, SSE2

Synopsis

FwStatus   fwiRGBToLUV_8u_C3R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToLUV_8u_AC4R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToLUV_16u_C3R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToLUV_16u_AC4R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToLUV_16s_C3R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToLUV_16s_AC4R ( const Fw16s * pSrcint srcStepFw16s * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToLUV_32f_C3R ( const Fw32f * pSrcint srcStepFw32f * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToLUV_32f_AC4R ( const Fw32f * pSrcint srcStepFw32f * pDstint dstStepFwiSize roiSize );

Parameters

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).

Description

These functions step through an ROI in a source buffer, convert the source data from the RGB color model to the LUV 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 LUV image (pDst) in two steps.

1. Convert( ) RGBToXYZ( ) using the following formulas.

 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].

2. Convert( ) XYZ to LUV as follows.

D65 white point:

 CIE chromaticity coordinates:

  xn = 0.312713
  yn = 0.329016

 CIE luminance:

  Yn = 1.0

 un = 4*xn / (-2*xn + 12*yn + 3)
 vn = 9*yn / (-2*xn + 12*yn + 3)
 u = 4*X / (X + 15*Y + 3*Z)
 v = 9*Y / (X + 15*Y + 3*Z)
 L = 116 * (Y/Yn)^(1/3) - 16
 U = 13*L*(u-un)
 V = 13*L*(v-vn)

 Computed L component values are in the range [0 to 100].
 Computed U component values are in the range [-124 to 220].
 Computed V component values are in the range [-140 to 116].

 The formulas assume that R, G, and B values are normalized to [0 to1] 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.

Scaling is performed as follows.

8U data type:

 L = L * FW_MAX_8U / 100
 U = (U + 134) * FW_MAX_8U / 354
 V = (V + 140) * FW_MAX_8U / 256

16U data type:

 L = L * FW_MAX_16U / 100
 U = (U + 134) * FW_MAX_16U / 354
 V = (V + 140) * FW_MAX_16U / 256

16S data type:

 L = L * FW_MAX_16U / 100 + FW_MIN_16S
 U = (U + 134) * FW_MAX_16U / 354 + FW_MIN_16S
 V = (V + 140) * FW_MAX_16U / 256 + FW_MIN_16S

32F data type:

 No conversion is applied, so the components remain in their ranges.