Convert from HLS to RGB
MT
| FwStatus | fwiHLSToRGB_8u_C3R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToRGB_8u_AC4R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToRGB_16u_C3R | ( | const Fw16u * pSrc, int srcStep, Fw16u * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToRGB_16u_AC4R | ( | const Fw16u * pSrc, int srcStep, Fw16u * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToRGB_16s_C3R | ( | const Fw16s * pSrc, int srcStep, Fw16s * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToRGB_16s_AC4R | ( | const Fw16s * pSrc, int srcStep, Fw16s * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToRGB_32f_C3R | ( | const Fw32f * pSrc, int srcStep, Fw32f * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToRGB_32f_AC4R | ( | const Fw32f * pSrc, int srcStep, Fw32f * pDst, int dstStep, FwiSize 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 HLS color space to the RGB color model, and write the converted data to a destination buffer.
An HLS image (pSrc) declared in the ROI is converted to a gamma-corrected RGB image (pDst) as follows.
if ( L <= 0.5)
M2 = L * (1+S)
else
M2 = L + S - L*S
M1 = 2*L - M2
if (S == 0)
R = G = B = L
else
{
h = H + 120
if (h > 360)
h = h - 360
if (h < 60)
R = (M1 + (M2 - M1)*h/60)
else if (h < 180)
R = M2
else if (h < 240)
R = M1 + (M2 - M1)*(240 - h)/60
else
R = M1
h = H
if (h < 60)
G = (M1 + (M2 - M1)*h/60)
else if (h < 180)
G = M2
else if (h < 240)
G = M1 + (M2 - M1)*(240 - h)/60
else
G = M1
h = H - 120
if (h < 60)
B = (M1 + (M2 - M1)*h/60)
else if (h < 180)
B = M2
else if (h < 240)
B = M1 + (M2 - M1)*(240 - h)/60
else
B = M1
}
The formulas assume that H, L, and S values are in the range [0 to 1].
For integer destination data type, the values are scaled to the full range of the data type.