HSVToRGB

Convert from HSV to RGB

Supported Technologies

MT

Synopsis

FwStatus   fwiHSVToRGB_8u_C3R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiHSVToRGB_8u_AC4R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiHSVToRGB_16u_C3R ( const Fw16u * pSrcint srcStepFw16u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiHSVToRGB_16u_AC4R ( const Fw16u * pSrcint srcStepFw16u * 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 HSV color space to the RGB color model, and write the converted data to a destination buffer.

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

if (S==0)
 R = G = B = V
else
{
 if (H == 360)
  H = 0
 else
  H = H/60
 I = floor(H)
 F = H - I
 M = V * (1 - S)
 N = V * (1 - S * F)
 K = V * (1 - s * (1 - F))
 if (I == 0)
  R = V
  G = K
  B = M
 if (I == 1)
  R = N
  G = V
  B = M
 if (I == 2)
  R = M
  G = V
  B = K
 if (I == 3)
  R = M
  G = N
  B = V
 if (I == 4)
  R = K
  G = M
  B = V
 if (I == 5)
  R = V
  G = M
  B = V
}

The computed image data is then scaled to the full range of the destination data type.