-
Notifications
You must be signed in to change notification settings - Fork 22
Need better RGB color implementation. #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@caternuson Is this still something that is needed? Looking at the PR referenced at the bottom of the issues you linked it looks like this library now matches the the code from that PR. |
Yep, that PR was merged. But I think this issue is still open. It relates specifically to the current code in the red = int(pow((int((r/clear) * 256) / 255), 2.5) * 255)
green = int(pow((int((g/clear) * 256) / 255), 2.5) * 255)
blue = int(pow((int((b/clear) * 256) / 255), 2.5) * 255) I'm not sure the origins of that are understood. Note how nothing else in the library uses To comply with the CircuitPython Design Guide, a property named |
Ah, I understand now. Thank you. |
@FoamyGuy Are you interested in working on this? |
@kattni I will try to tackle it. The details of the color computations are a bit over my head but clicking through some of the linked issues and PR threads I found more information and links to other resources. I can start by trying to use the It seems the header breakouts for this device are out of stock at Adafruit and Digikey currently. https://www.adafruit.com/product/1334 However there is a Flora variant of the sensor breakout also and there are plenty of those available. I will get one ordered to use for testing the changes. |
I am pretty sure the |
In the projects that use the color sensor, like the Piano Glove, FLORAbrella, and Chameleon Scarf, the Arduino code given uses the raw values from the sensor, normalizes them, and then applies a gamma correction. I'm pretty sure this is equivalent to the calculations in this issue. From what I can tell, the code in I would also suggest adding some extra code to |
@FoamyGuy @caternuson Do you mind following up with @SilviaCC's suggestion regarding this issue? Thanks! |
@SilviaCC Please file another issue for the simpletest update, and if you're interested in doing so, please update the simpletest.py file and submit a PR. |
@kattni Sure, I can do that. |
@SilviaCC Excellent sleuthing. @boukeas Seems like you also suggested same. That does appear to be a baked in gamma correction. @kattni I agree with the general idea of closing this issue as well as PR #31. Adding some code comment would be a good idea. @SilviaCC Do you want to do that as part of PR to update simpletest? |
@caternuson Yes, no problem, I'm working on it (though rather slowly, I'm navigating my first GitHub contribution) |
Fixed by #37 . Thanks @elpekenin for the heads up :) |
The current implementation of
color
is in need of replacement. See discussions in #14 and #10 .The text was updated successfully, but these errors were encountered: