Skip to content Skip to sidebar Skip to footer

Wrong HSV Conversion From RGB

I have these lists containing blue values in RGB format. low = [ [0, 0, 128], [65, 105, 225], [70, 130, 180], [72, 61, 139], [83, 104, 120] ] What I want to ma

Solution 1:

The tool you used for verification has range [0,359] for Hue, and range [0,100] for Saturation and Value. OpenCV's HSV ranges are [0,179] for Hue, [0,255] for Saturation and Value.

Multiply by 2, 1/2.55, 1/2.55 and you will get the expected values, off by minor integer truncation errors: [103 79 120] * [2 1/2.55 1/2.55] = [206 31 47]


Solution 2:

Although @FBergo's answer is correct, I'd like to add that these conversions (multiply by...) are type-dependent and care must be taken when using conversions for 8UC3, 16SC3, 32SC3, 32FC3 and so on.


Post a Comment for "Wrong HSV Conversion From RGB"