thevoiceover Posted October 4, 2007 Report Posted October 4, 2007 I am curious on if anyone has anything that could convert HSL to RGB for me that I could run in some LabVIEW code.. I could have sworn I had a .dll way back that did this, but I can't find it... I couldn't find anything in LV that did this either... I am running 7.1.1 Quote
siva Posted October 5, 2007 Report Posted October 5, 2007 QUOTE(thevoiceover @ Oct 4 2007, 12:48 AM) I am curious on if anyone has anything that could convert HSL to RGB for me that I could run in some LabVIEW code.. I could have sworn I had a .dll way back that did this, but I can't find it... I couldn't find anything in LV that did this either... I am running 7.1.1 You could build your own .dll or SubVI using the standard conversion formula available at, http://en.wikipedia.org/wiki/HSL_color_space Quote
Neville D Posted October 5, 2007 Report Posted October 5, 2007 There are functions in the IMAQ Vision tool-kit from NI that allow you to do that and much more. It is expensive, though. Neville. Quote
thevoiceover Posted November 1, 2007 Author Report Posted November 1, 2007 QUOTE(Neville D @ Oct 4 2007, 10:54 AM) There are functions in the IMAQ Vision tool-kit from NI that allow you to do that and much more. It is expensive, though.Neville. Yes and I am broke.... Oh well.. Quote
PJM_labview Posted November 1, 2007 Report Posted November 1, 2007 QUOTE(thevoiceover @ Oct 30 2007, 03:51 PM) Yes and I am broke.... Oh well.. Use the following code to write your own "HSL to RGB.vi" in LabVIEW. It does not take that long. /****************************************************************************** FUNCTION: HLStoRGB PURPOSE: Convert from HSL to RGB IN: Hue, Saturation, Luminance from 0 to 1 RETURN: RGB color (0xRRGGBB) COPYRIGHT:1995-1997 Robert Mashlan Modified for LabWindows/CVI, 1999 Guillaume Dargaud ******************************************************************************/ typedef unsigned char BYTE; // 8-bit unsigned entity COLORREF HLStoRGB(const double H, const double L, const double S ) { double r,g,b; double m1, m2; if (S==0) r=g=b=L; else { if (L <=0.5) m2 = L*(1.0+S); else m2 = L+S-L*S; m1 = 2.0*L-m2; r = HueToRGB(m1,m2,H+1.0/3.0); g = HueToRGB(m1,m2,H); b = HueToRGB(m1,m2,H-1.0/3.0); } return MakeRGB((BYTE)(r*255),(BYTE)(g*255),(BYTE)(b*255)); }/****************************************************************************** FUNCTION: HueToRGB PURPOSE: Convert a hue (color) to RGB COPYRIGHT:1995-1997 Robert Mashlan Modified for LabWindows/CVI, 1999 Guillaume Dargaud******************************************************************************/static double HueToRGB(const double m1, const double m2, double h ) { if (h<0) h+=1.0; if (h>1) h-=1.0; if (6.0*h < 1 ) return (m1+(m2-m1)*h*6.0); if (2.0*h < 1 ) return m2; if (3.0*h < 2.0) return (m1+(m2-m1)*((2.0/3.0)-h)*6.0); return m1;} PJM Quote
Tim_S Posted November 10, 2007 Report Posted November 10, 2007 This what you're looking for? QUOTE(thevoiceover @ Oct 3 2007, 02:18 PM) I am curious on if anyone has anything that could convert HSL to RGB for me that I could run in some LabVIEW code.. I could have sworn I had a .dll way back that did this, but I can't find it... I couldn't find anything in LV that did this either... I am running 7.1.1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.