Converts an RGB image to the HLS color model.
IppStatus ippiRGBToHLS_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);
Supported values for mod:
8u_C3R | 16u_C3R | 16s_C3R | 32f_C3R |
8u_AC4R | 16u_AC4R | 16s_AC4R | 32f_AC4R |
pSrc |
Pointer to the source image ROI. |
srcStep |
Distance in bytes between starts of consecutive lines in the source image. |
pDst |
Pointer to the destination image ROI. |
dstStep |
Distance in bytes between starts of consecutive lines in the destination image. |
roiSize |
Size of the source and destination ROI in pixels. |
The function ippiRGBToHLS is declared in the ippcc.h file. It operates with ROI (see Regions of Interest in Intel IPP).
This function converts the R'B'G' image pSrc to the HLS image pDst. For function flavors operating on the floating point data, source RGB values must be in the range [0..1].
The conversion algorithm from RGB to HLS can be represented in pseudocode as follows:
// Lightness: M1 = max(R,G,B); M2 = min(R,G,B); L = (M1+M2)/2 // Saturation: if M1 = M2 then // achromatics case S = 0 H = 0 else // chromatics case if L <= 0.5 then 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 R = M2 then H = Cb - Cg if G = M2 then H = 2 + Cr - Cb if B = M2 then H = 4 + Cg - Cr H = 60*H if H < 0 then H = H + 360
For floating point function flavors, the computed H, L, S values are scaled to the range [0..1]. In case of integer function flavors, these values are scaled to the full range of the destination data type (Table “Image Data Types and Ranges”).
ippStsNoErr |
Indicates no error. Any other value indicates an error. |
ippStsNullPtrErr |
Indicates an error condition if pSrc or pDst is NULL. |
ippStsSizeErr |
Indicates an error condition if roiSize has a field with a zero or negative value. |
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.