Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

RGBToHLS and HLSToRGB small error


I found that doing a straight conversion from RGB to HLS and back to RGB ( RGBToHLS and HLSToRGB) produces a small error (+/-2 gray levels) for some colors. I did not do very much investigation but I am just wondering if this is expected or it there someting wrong.

In case, it makes a difference, what I really did is:

1) convert a 8u RGB image to 16u
2) convert to 16u HLS
3) convert to 16u RGB
4) convert to 8u RGB'

The difference between RGB and RGB' is +/- 2 gray levels for about half of all possible RGB colors and 0 for the other half colors (usinga test image with all the 16 millions colors).

I dont see such a differnce for HSV.

Any reason for the HLS difference, is it due to the equations?

Thank you!


0 Kudos
1 Reply

Ok, I found the problem. I used ippiConvert to go to 16 bits but I should have used ippiScale (ippiConvert does not scale the input image as I first thought...). I dont see any conversion error when I use a properly scaled input image to 16 bits.