Question by
wedermarco · Feb 19, 2021 at 09:28 PM ·
coloropencvrgbcolor-space
weird results when using RGBToHSV
Hello, I'm having a problem when using the method Color.RGBToHSV.
In the docs
https://docs.unity3d.com/ScriptReference/Color.RGBToHSV.html
it says, that the H, S and V value are between 0 and 1. But if I use the method like this:
private void Start()
{
Color.RGBToHSV(new Color(150, 240, 100), out float h1, out float s1, out float v1);
Debug.Log($"{h1}, {s1}, {v1}");
}
I'm getting the result:
0.2738095 for Hue 0.5833333 for Saturation 240 for Value
Sometimes the value is between 0 and 1 and sometimes it is between 0 and 255. This doesn't make any sense to me. Is this a bug or is something wrong with my code?
Thanks in advance :)
Comment