You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[28] | This mode is not usable. When in COL-CAL mode, the color sensor does not respond to the keep-alive sent from the EV3 brick. As a result, the sensor will time out and reset.
so will skip those unless the quote above is no longer accurate.
I'm not sure what all we should add here...wait_for_color(...) might be handy. What methods would make line followers easier to code?
Do you guys see the RGB values that come from the sensor as very very dark? I can point mine at the white side of a rubiks cube and it comes back with numbers like (34, 58, 46) on 0-255 scale. That is basically dark green: https://www.w3schools.com/colors/colors_converter.asp
Prior to this commit ColorSensor.rgb() took the raw RGB values and scaled them to 0-255 based on a 0-1020 scale (since that is the official range of the values returned by the sensor). The color sensor never returns anything close to 1020 though so the end result was that we got very dark RGB values out of rgb(). A typical MINDCUBER scan of a rubiks cube would look like this:
Now we have a calibrate_white() function the user can call (to be called when the color sensor is looking at something white) to figure out what are the maximum RGB values we can expect to see. ColorSensor.rgb() will then scale the results to 0-255 based on those max values. The result is that you get much brighter/accurate data:
Note that the two pics above are of different rubiks cubes but you get the idea, the colors in the second one are much more accurate than the first.
RGB is very handy for printing in web pages for debugging color issues but sucks for computing color distances of one color vs. another. HSV I never had much luck with for color comparison. I found that Lab color space works best for comparing colors, you take the euclidean distance between the two colors and that works really well. This is what I use for all of the color resolving that has to happen in cranecuber.
I have a function that converts RGB to Lab without importing any additional modules. I'll add a lab() method to the ColorSensor.
Activity
dwalton76 commentedon Sep 23, 2017
For the two calibrate methods per
http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensor_data.html
[28] | This mode is not usable. When in COL-CAL mode, the color sensor does not respond to the keep-alive sent from the EV3 brick. As a result, the sensor will time out and reset.
so will skip those unless the quote above is no longer accurate.
I'm not sure what all we should add here...
wait_for_color(...)might be handy. What methods would make line followers easier to code?dwalton76 commentedon Sep 23, 2017
Do you guys see the RGB values that come from the sensor as very very dark? I can point mine at the white side of a rubiks cube and it comes back with numbers like (34, 58, 46) on 0-255 scale. That is basically dark green:
https://www.w3schools.com/colors/colors_converter.asp
I'm wondering if this thing is broken.
dwalton76 commentedon Oct 11, 2017
Prior to this commit
ColorSensor.rgb()took the raw RGB values and scaled them to 0-255 based on a 0-1020 scale (since that is the official range of the values returned by the sensor). The color sensor never returns anything close to 1020 though so the end result was that we got very dark RGB values out ofrgb(). A typical MINDCUBER scan of a rubiks cube would look like this:Now we have a
calibrate_white()function the user can call (to be called when the color sensor is looking at something white) to figure out what are the maximum RGB values we can expect to see.ColorSensor.rgb()will then scale the results to 0-255 based on those max values. The result is that you get much brighter/accurate data:Note that the two pics above are of different rubiks cubes but you get the idea, the colors in the second one are much more accurate than the first.
dlech commentedon Oct 14, 2017
FYI, converting to HSV or some other colorspace would be even more accurate.
dwalton76 commentedon Oct 14, 2017
RGB is very handy for printing in web pages for debugging color issues but sucks for computing color distances of one color vs. another. HSV I never had much luck with for color comparison. I found that Lab color space works best for comparing colors, you take the euclidean distance between the two colors and that works really well. This is what I use for all of the color resolving that has to happen in cranecuber.
I have a function that converts RGB to Lab without importing any additional modules. I'll add a
lab()method to the ColorSensor.dwalton76 commentedon Oct 14, 2017
PS
This is a good article on python and color sorting
http://www.alanzucconi.com/2015/09/30/colour-sorting/