Community
cancel
Showing results for
Did you mean:
Beginner
327 Views

## Converting Hue to Degrees

I am comparing an image with known HSV to my output using the IPP library.

True Values:
H 149
S 80
V 100

Output from Ipp call converting from RGB to HSV:
H 64
S 205
V 255

If I normalize by 255,
H 0.25
S 0.80
V 1.00

So, this explains the encoding for S and V.

What I expect is to multiply the normalized Hue value by 360 to get back the "true" value, which in this case should be 149.As you can see I am getting back 90 instead.

What don't I understand about the IPP representation of Hue?

Thanks!

5 Replies
Beginner
327 Views

p.s. I also assumed that Hue was in radians, but am not getting my true value back.

Beginner
327 Views

I used a HLS conversion on the same image.

The "true" values:
H 149
L 60
S 100

The values from the HLS:
H 105
L 153
S 255

If I normalize (divide by 255):
H 0.41
L 0.6
S1.0

and then multiply H by 360 and L and S by 100
H 148
L 60
S 100

Not too bad of a match.

So the H in the IPP HLS algorithm gives approxthe right answer, but the H in the IPP HSV algorithm is still a mystery.

Thanks!
Employee
327 Views
What RGB values you use to get these output HSV?

Beginner
327 Views
What RGB values you use to get these output HSV?

Thanks for your response. The values I used were:

R 50
G 255
B 150

I added the testimage (green149.jpg) as an attachment.

I was a bit confused whether the red and blue channels needed to beswapped The HLS method (which appears to be bringing back the correct results) is named "ippiBGRToHLS" (not, RGB to HLS), whereas the HSV method (which appears to not be correct) is named "ippiRGBtoHSV".

Having played with this problem a bit more this morning, it appears that I need to swap the R and B channels from the order in which they naturally occur in my imported Bitmap, whenever I use a method named RGB.

Sound right?

ps just tested and this did the trick.
Employee
327 Views
Correct, RGB in IPP function names should mean exactly R-G-B-R-G-B channel ordering whereas BGR in the name means opposite ordering.

Regards,