Convert from HLS to BGR
MT
| FwStatus | fwiHLSToBGR_8u_C3P3R | ( | const Fw8u * pSrc, int srcStep, Fw8u * const pDst[3], int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToBGR_8u_AC4P4R | ( | const Fw8u * pSrc, int srcStep, Fw8u * const pDst[4], int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToBGR_8u_AP4R | ( | const Fw8u * const pSrc[4], int srcStep, Fw8u * const pDst[4], int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToBGR_8u_P3R | ( | const Fw8u * const pSrc[3], int srcStep, Fw8u * const pDst[3], int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToBGR_8u_AP4C4R | ( | const Fw8u * const pSrc[4], int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiHLSToBGR_8u_P3C3R | ( | const Fw8u * const pSrc[3], int srcStep, Fw8u * 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. | |
| pDst[3] | Pointer to a location in a three-channel planar destination buffer (array values point to a location in each plane). | |
| pDst[4] | Pointer to a location in a four-channel planar destination buffer (array values point to a location in each plane). | |
| pSrc | Pointer to a location in a source buffer. | |
| pSrc[3] | Pointer to a location in a three-channel planar source buffer (array values point to a location in each plane). | |
| pSrc[4] | Pointer to a location in a four-channel planar source buffer (array values point to a location in each plane). | |
| 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 BGR 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.