08-19-2008 04:24 PM - edited 08-19-2008 04:25 PM
08-19-2008 07:06 PM
There is a a RGB conversion vi at: vi.lib\Utility\colorconv.llb\Color to RGB.vi
Is this what you are looking for?
08-19-2008 11:02 PM
08-20-2008 08:07 AM
Hue and Lumanence based color space is different from RGB based color space.
I've got some converters that I wrote based on a few algorythms that I read online.
(I don't have the web-pages that I used handy, and didn't note them in the subVI, so I appologise to the people who wrote the algorythm that I used.)
The subVI's will convert from the standard LabVIEW color box value to the associated Hue, Saturation, Lumanence values of the HSL color space and back.
08-20-2008 08:31 AM
Hi Mythilt,
Thank you for your help.
08-20-2008 12:35 PM - edited 08-20-2008 12:41 PM
Jon,
That looks like a nice and useful tool.
However, there seems to be some accuracy problem that I don't think can be attributed to just working with floating point numbers in a digital environment.
I entered values into HSLToRGB Raw.vi, ran it, then copied the data from the resulting colorbox and pasted it into the colorbox of RGBToHSL Raw.vi and ran that. The resulting value for saturation is significantly different from the original value.
I reversed the process and the resulting colorboxes do have different colors.
I've attached an image of my comparisons.
(I don't have the know-how to spot where the inaccuracy comes from. I just felt that I should let you know.)
08-20-2008 01:20 PM
Sorry, thought that I had fixed that. There is a < in the RGBtoHSL that needs to be <= instead. Attached is the corrected version.
One other thing to note, if you want to convert the HSL to windows color picker values, you need to remember that the windows color picker max values for its HSL representation are {239,240,240}, not {255,255,255}, so just multiply the numbers given by my converter by the appropriate value.
08-20-2008 02:11 PM
Jon,
That cured it for 0.5 Luminance, but for Luminance values above 0.5 (like 0.6), the problem returns.
08-20-2008 02:52 PM - edited 08-20-2008 02:55 PM
I could have sworn that was the fix. hrm, let me see if I can find the original C++ program example that I based the LabVIEW code off of. There is another algorithm at http://en.wikipedia.org/wiki/HSL_color_space which is similar. I might update this code to it since finding it on the wikipedia is much easier than searching through tons of Google pages.
Embarassing, found the original page off the wikipedia page....
http://www.easyrgb.com/index.php?X=MATH
08-21-2008 08:02 AM