LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hue to RGB conversion

Is there anyway to convert hue to RGB?
Message Edited by test_man on 08-19-2008 05:25 PM
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 1 of 12
(12,218 Views)

There is a a RGB conversion vi at: vi.lib\Utility\colorconv.llb\Color to RGB.vi

 

Is this what you are looking for?

_______________________________________
Systems Test Engineer
Certified LabVIEW Architect (CLA)
0 Kudos
Message 2 of 12
(12,205 Views)
Are Colour & Hue one n the same or slightly different?
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 12
(12,197 Views)

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.

 

 

Jon D
Certified LabVIEW Developer.
Message 4 of 12
(12,160 Views)

Hi Mythilt,

Thank you for your help.

Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
0 Kudos
Message 5 of 12
(12,151 Views)

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.)

 

 

Message Edited by Tobin on 08-20-2008 12:41 PM
0 Kudos
Message 6 of 12
(12,114 Views)

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.

 

 

Jon D
Certified LabVIEW Developer.
0 Kudos
Message 7 of 12
(12,106 Views)

Jon,

That cured it for 0.5 Luminance, but for Luminance values above 0.5 (like 0.6), the problem returns.

0 Kudos
Message 8 of 12
(12,100 Views)

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

Message Edited by Mythilt on 08-20-2008 03:55 PM
Jon D
Certified LabVIEW Developer.
0 Kudos
Message 9 of 12
(12,095 Views)
Here are some color utilities I wrote many moons ago.  There is a hue conversion buried in there somewhere.  Let me know if you run into issues.
0 Kudos
Message 10 of 12
(12,054 Views)