Replies: 3 comments
-
Could you explain more about the bigger picture of what you are trying to accomplish? I think that will help determine the best solution. |
Beta Was this translation helpful? Give feedback.
-
For measuring ambient color with |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for the help! I was trying to communicate through light colors. I wanted to send 3 values across, and it would have been nice to code each value as the intensity of a light wavelength (R,G and B), as measured by the sensor hardware. But I will look for a different solution now. |
Beta Was this translation helpful? Give feedback.
-
I recently had a use case for RGB color reading unreflected incoming light (surface=False).
Pybricks only returns HSV, so I tried PUPDevice reading the sensor in mode 7. But I couldn't make sense of the values. They seem to be h,s,v, and color match. But I'm not sure. Where can I find documentation about this?
Then I tried converting Pybricks HSV to RGB, but the reported HSV values seemed off. Especially saturation:
What I did was, hang the color sensor 5mm above my iPad in a darkened room. Then I turn the screen of my iPad green (#00FF00). It gets the hue and value right: 128 and 100. But it also sets the saturation at 50.
According to Wikipedia (https://en.wikipedia.org/wiki/HSL_and_HSV) full green should be 128, 100, 100, not 128,50,100.
Then I turn the screen full white. I get (215, 19, 100). I was expecting (x, 0, 100). Saturation keeps floating around 19 until I turn the screen nearly black, and the sensor correctly reports (0,0,0).
When I turn the screen blue (#0000FF). The sensor reports (226 97 89), which is close enough. A red screen leads to (352 86 94). Also close enough. But with fully saturated green, teal, purple, magenta, and yellow, the reported saturation plummets to about 50-60. The v stays around 100, which is expected.
Long story short: reported saturation seems off at any color that is not entirely blue or red.
How can I best help to make this more accurate? Correct HSV or raw RGB is what I am looking for.
Beta Was this translation helpful? Give feedback.
All reactions