Convert from BGR to HLS
MT
| FwStatus | fwiBGRToHLS_8u_AC4R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiBGRToHLS_8u_C3P3R | ( | const Fw8u * pSrc, int srcStep, Fw8u * const pDst[3], int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiBGRToHLS_8u_AC4P4R | ( | const Fw8u * pSrc, int srcStep, Fw8u * const pDst[4], int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiBGRToHLS_8u_AP4R | ( | const Fw8u * const pSrc[4], int srcStep, Fw8u * const pDst[4], int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiBGRToHLS_8u_P3R | ( | const Fw8u * const pSrc[3], int srcStep, Fw8u * const pDst[3], int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiBGRToHLS_8u_AP4C4R | ( | const Fw8u * const pSrc[4], int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
| FwStatus | fwiBGRToHLS_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 BGR color model to the HLS color space, and write the converted data to a destination buffer.
A gamma-corrected BGR image (pSrc) declared in the ROI is converted to an HLS image (pDst) as follows.
// Lightness:
M1 = max(R, G, B)
M2 = min(R, G, B)
L = (M1+M2)/2
// Saturation:
If (M1 == M2)
S = H = 0
else // chromatics case
{
if (L <= 0.5)
S = (M1-M2) / (M1+M2)
else
S = (M1-M2) / (2-M1-M2)
//Hue:
Cr = (M1-R) / (M1-M2)
Cg = (M1-G) / (M1-M2)
Cb = (M1-B) / (M1-M2)
if (M1 == R)
H = Cb - Cg
if (M1 == G)
H = 2 + Cr - Cb
if (M1 == B)
H = 4 + Cg - Cr
H = H * 60
if (H < 0)
H = H + 360
}
The formulas assume that R, G, and B 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.