Convert from RGB to HLS
MT
FwStatus | fwiRGBToHLS_8u_C3R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHLS_8u_AC4R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHLS_16u_C3R | ( | const Fw16u * pSrc, int srcStep, Fw16u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHLS_16u_AC4R | ( | const Fw16u * pSrc, int srcStep, Fw16u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHLS_16s_C3R | ( | const Fw16s * pSrc, int srcStep, Fw16s * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHLS_16s_AC4R | ( | const Fw16s * pSrc, int srcStep, Fw16s * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHLS_32f_C3R | ( | const Fw32f * pSrc, int srcStep, Fw32f * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToHLS_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 RGB color model to the HLS color space, and write the converted data to a destination buffer.
A gamma-corrected RGB 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.