Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Question about the HLS color mode

pango
Beginner
340 Views
I'm writing a color correct application,the app convert a RGB image to HLS format,and the adjust the H,L,S companents.I use IPP todo the converting,but I don't know the data format of the converted HLS image,I mean I don't know which byte is the H companent,and which is the L or S companent,and I also don't know the max & min value of each companent,so anyone can help me?
0 Kudos
1 Reply
Vladimir_Dudnik
Employee
340 Views

Hi,

For ippiRGBToHLS_8u_C3R() we've written next:

H is the hue red at 0 degrees, which has range [0 .. 360 degrees],
L is the lightness , it has range [0. .. 1.],
S is the saturation, it has range [0. .. 1.]

H,L,S are scaled to the range:

[0..IPP_MAX_8u] for the 8u depth.

H = H * IPP_MAX_8U / 360.f;
L = L * IPP_MAX_8U;
S = S * IPP_MAX_8U;

To restore the true value(H,L,S) after ippiRGBToHLS_8u they should do next calculation:

H = (Ipp32f)H*360.f/(Ipp32f)IPP_MAX_8U;
L = (Ipp32f)L/(Ipp32f)IPP_MAX_8U;
S = (Ipp32f)S/(Ipp32f)IPP_MAX_8U;

Data is found in memory as an array of unsigned characters in which the first byte contains the H, the second byte contains the L, the third byte contains S.

P.S.: Please see ippiman.pdf for more details

Regards,
Vladimir

0 Kudos
Reply