looking for code or formula: rgb to rgba conversion / colour space conversion

113 views
Skip to first unread message

hacker.r...@gmail.com

unread,
Jun 7, 2016, 11:36:00 AM6/7/16
to open-lighting
Hi

hope this is not off topic:

I need to convert the RGB values to RGBA and on top take into consideration the wavelength of my LEDs.
Could any one point me to a code snippet or the formula?
my input would be:
    rgb values + wavelengths of my RGBA LEDs
required output:
    RGBA values

Alternatively whih forum might be more suitable for my question?

Thx

James Elliott

unread,
Jun 11, 2016, 11:53:18 PM6/11/16
to open-lighting
I don’t know if you are going to find any forum where this is precisely on topic, and if you find a definitive answer, I hope you will post back here because I would love to implement it as well! I have been researching along these lines for about a year and still have a great deal to learn. Here is some code that I am experimenting with along those lines in my own lighting controller: https://github.com/brunchboy/afterglow/blob/master/src/afterglow/effects/color.clj#L78-L119

It doesn’t do exactly what you ask, but it is similar. Given an RGB color it first figures the standard RGBW levels you would assign, assuming that your LED wavelengths precisely match the hues red, green, and blue. Then for any additional LEDs you have of a particular hue, it figures out what level they should be illuminated at. I use this with some RGBAW+UV fixtures and it gives nice results, if not perfect. You will need to convert your LED dominant wavelengths to a color-wheel hue value to use these calculations.

  -James

James Elliott

unread,
Jun 11, 2016, 11:56:17 PM6/11/16
to open-lighting
Oh, I forgot to include this link to an amazing site about color vision that has helped me a great deal in learning about these kinds of issues: http://handprint.com/LS/CVS/color.html


On Tuesday, June 7, 2016 at 10:36:00 AM UTC-5, hacker.r...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages