Open AlecHub opened 4 years ago
Javadoc says the argb() method of the ColorSensor interface returns "hue", which is incorrect.
argb() returns Alpha/Red/Green/Blue channels packed into an int.
You have to use the colorToHSV() method to convert the argb() value to HSV:
float[] hsvValues = new float[3]; Color.colorToHSV(color_sensor.argb(), hsvValues); float hue = hsvValues[0]; // [0, 360] float sat = hsvValues[1]; // [0, 1] float val = hsvValues[2]; // [0, 1]
Javadoc says the argb() method of the ColorSensor interface returns "hue", which is incorrect.
argb() returns Alpha/Red/Green/Blue channels packed into an int.
You have to use the colorToHSV() method to convert the argb() value to HSV: