Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

Javadoc error - ColorSensor interface #140

Open
AlecHub opened this issue Nov 16, 2019 · 0 comments
Open

Javadoc error - ColorSensor interface #140

AlecHub opened this issue Nov 16, 2019 · 0 comments

Comments

@AlecHub
Copy link

AlecHub commented Nov 16, 2019

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]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant