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

RGBToHLS

Adriaan_van_Os
New Contributor I
282 Views

In the headers and documentation for ippiRGBToHLS (both for ipp v9 and v2017) the following pseudo-code is given

      if R = M2 then H = Cb - Cg

      if G = M2 then H = 2 + Cr - Cb

      if B = M2 then H = 4 + Cg - Cr

 

referring to 

      David F.Rogers

      Procedural Elements for Computer Graphics

      1985.pp.(403-406)

 

However, in that book (2nd ed. 1998) on page 629 I read

      if R = M1 then H = Cb - Cg

      if G = M1 then H = 2 + Cr - Cb

      if B = M1 then H = 4 + Cg - Cr

 

and this does give different results. I haven't checked what ipp actually does, but at least there is a discrepancy in the documentation and headers.

Regards,

Adriaan van Os

 

0 Kudos
2 Replies
Zhen_Z_Intel
Employee
282 Views

Hi Adriaan:

It should be the mistake of document. I tested RGBToHLS function with simply code. The result is correct.

For instance, I tested with value of RGB is {56,45,36}, the output of MKL ippiRGBToHLS_8u_C3R function is like below:

And you could calculate the get value of H,L,S:

H=19/255*360=26.8    same as    60*(G - B)/(Max-Min)

L=46/255*100%=18

S=55/255*100%=21.6

Thank you for posting the mistake of developer guide document. We will fix it.

Best regards,
Fiona

 

 

0 Kudos
Zhen_Z_Intel
Employee
282 Views

Hi Adriaan,

The problem has been fixed in document, please refer to have a check.

Best regards,
Fiona

0 Kudos
Reply