Hello All,
I am trying to convert frequency values to colors. For example I know the color blue is around 610-670 THz, with 610 THz being closer to the green side and 670 THz closer to the violet side. What I would like to show would be the "exact" color of say 635 THz. Is there some kind of color frequency to hex converter available? The colors do not really matter to me, but it seems 92% of the population think colors matter. Regards, Mon
******
And AC said, "LET THERE BE LIGHT!" "The Last Question" - Isaac Asimov |
On 28 December 2011 00:42, Mech.Mon <[hidden email]> wrote:
> Hello All, > > I am trying to convert frequency values to colors. For example I know the > color blue is around 610-670 THz, with 610 THz being closer to the green > side and 670 THz closer to the violet side. What I would like to show would > be the "exact" color of say 635 THz. > > Is there some kind of color frequency to hex converter available? > > The colors do not really matter to me, but it seems 92% of the population > think colors matter. > > Regards, > Mon Not really an Octave question. However, I was interested: googling "wavelength to RGB" turned up http://www.uvm.edu/~kspartal/Physlets/Lecturedemo/LambdaToRGB.html http://www.physics.sfasu.edu/astro/color/spectra.html I leave frequency to wavelength conversion as an exercise for the reader. -- /* andy buckle */ _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave |
In reply to this post by Mech.Mon
See attached. You'll have to convert the frequency to wavelength in nm. The function returns an RGB value set for a given wavelength in nm. Note, I didn't write the original algorithm, I just recoded it to work with Matlab/Octave. The source is linked in the notes. As an FYI the example in the code was written in matlab, I noticed it plots very slowly in octave (at least on windows). William Krekeler _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave wavelength2rgb.m (4K) Download Attachment |
On 28 December 2011 14:03, William Krekeler
<[hidden email]> wrote: > > See attached. You'll have to convert the frequency to wavelength in nm. The function returns an RGB value set for a given wavelength in nm. Note, I didn't write the original algorithm, I just recoded it to work with Matlab/Octave. The source is linked in the notes. As an FYI the example in the code was written in matlab, I noticed it plots very slowly in octave (at least on windows). > > William Krekeler Hi William this function does not have a license. Could you please specify one? That way we could add to one of the packages. Carnë _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave |
-----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Carnë Draug Sent: Tuesday, January 10, 2012 12:12 PM To: William Krekeler Cc: Mech.Mon; [hidden email] Subject: Re: Color By Frequency On 28 December 2011 14:03, William Krekeler <[hidden email]> wrote: > > See attached. You'll have to convert the frequency to wavelength in nm. The function returns an RGB value set for a given wavelength in nm. Note, I didn't write the original algorithm, I just recoded it to work with Matlab/Octave. The source is linked in the notes. As an FYI the example in the code was written in matlab, I noticed it plots very slowly in octave (at least on windows). > > William Krekeler Hi William this function does not have a license. Could you please specify one? That way we could add to one of the packages. Carnë Carnë, I guess GPLv3 but legally I'm not sure I can prescribe a license. I didn't write the algorithm. I only adapted it to matlab/octave code structure. If you follow the source link listed in the header backwards I think the algorithm actually belongs to Dan Bruton of http://www.midnightkite.com/color.html. The original contact information listed is: Dan Bruton ([hidden email]) but the higher level link now lists ([hidden email]). I will contact him separately and cc you on the email. William Krekeler _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave |
2012/1/11 William Krekeler <[hidden email]>:
> I guess GPLv3 but legally I'm not sure I can prescribe a license. I > didn't write the algorithm. I only adapted it to matlab/octave code > structure. If you follow the source link listed in the header > backwards I think the algorithm actually belongs to Dan Bruton of > http://www.midnightkite.com/color.html. I'm not a lawyer, but I'm pretty sure that algorithms don't have owners (i.e. copyright). An expression of it (i.e. code for a specific language) does. If you wrote the algorithm based on other code, your version of it could be considered derivative work and fall under the copyright of the original code. But if this is not the case, you saying that you learned the algorithm somehow and telling us your rendition of the algorithm is GPLv3, that's good enough for us. It would be nice to tell Dan Bruton that we're using his algorithm in Octave, but it doesn't seem to me strictly necessary to get this into Octave. - Jordi G. H. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave |
I'm not a lawyer either, I'd just rather 'play nice '. If the algorithm was the normal read a paper, then download the requisite 30 background and cross-referenced papers to understand what was read before you can implement the suggested solution, I would agree completely with you. However, Dan published some code (I think Fortran) which I converted to Octave/Matlab and wrote a few test cases to confirm that it worked. A lawyer is likely going to argue that the Octave code is a derivative work and the source should be given the opportunity to weigh in. I chose to contact him to give him that opportunity.
William Krekeler _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave |
The conversion from wavelength to RGB is not a mathematical alogrithm that can be derived from a set of universal axioms. The output is an approximation of the response of a human eye to a given input. It is based on measurements of eye responses. Any particular approximation is based on a particular definition of R, G, B, white (or illumination), and non-linear corrections (or gamma). The CIE standards body has published eye responses of a standard observer, defined various ways of converting a given reponse to values representing a color, and published the color numbers for monochromatic light at all visible wavelengths. No license is needed to use this information. Wading through this information, choosing R, G, B, illumination, and gamma, and deriving the math of converting wavelength to RGB is not trivial. Apparently Dan Bruton has done it. At least, he has published code that does some sort of conversion. If William Krekeler has adapted this code, his work is clearly derivative. Because of this, I expect he would need permision to publish it. If he had done the work himself, I expect he would not need permission, regardless of how closely his work parallels other work. But I am not a lawyer either. It seems very likely that Dan Bruton does not mind if people use his code. He apparently published it so people would use it. He put his name in the code, but no copyright notice. His website contains a link to an article favoring freedom of speech over copyright enforcement. Still, asking permission and acknowledging contributions are entirely appropriate. Note that his code does not mention his choice of R, G, B, illumination, or gamma. As long as William is talking to him, it might be good to ask him what these are and add a comment describing them to the code. William might also note the limitations of this conversion. RGB is good at describing the colors that can be produced by a monitor. The human eye is sensitive to more colors than this. We can see colors that cannot be described by positive RGB numbers. As it happens, none of the pure spectral colors can be represented given the usual parameter choices. For more information, see this stackoverflow article or this Wikipedia article. |
In reply to this post by Mech.Mon
GREAT SYNOPSIS!
Where in the 'color' chart does the folowing phenomenon fall? Paint a wheel half black and half white. As the wheel spins faster and faster, the eye perceives the wheel to be colored. Is there any insight into better understanding of color perception with the 'wheel experiment' in mind? Or, does this observation just fall under the, "Oh, that's interesting," heading? --- [hidden email] wrote: From: mmesser314 <[hidden email]> To: [hidden email] Subject: RE: Color By Frequency Date: Thu, 12 Jan 2012 13:31:53 -0800 (PST) Jordi Gutiérrez Hermoso wrote > > I'm not a lawyer, but I'm pretty sure that algorithms don't have > owners (i.e. copyright). An expression of it (i.e. code for a specific > language) does. If you wrote the algorithm based on other code, your > version of it could be considered derivative work and fall under the > copyright of the original code. But if this is not the case, you > saying that you learned the algorithm somehow and telling us your > rendition of the algorithm is GPLv3, that's good enough for us. > > It would be nice to tell Dan Bruton that we're using his algorithm > in Octave, but it doesn't seem to me strictly necessary to get this > into Octave. > William Krekeler wrote > > I'm not a lawyer either, I'd just rather 'play nice '. If the algorithm > was the normal read a paper, then download the requisite 30 background and > cross-referenced papers to understand what was read before you can > implement the suggested solution, I would agree completely with you. > However, Dan published some code (I think Fortran) which I converted to > Octave/Matlab and wrote a few test cases to confirm that it worked. A > lawyer is likely going to argue that the Octave code is a derivative work > and the source should be given the opportunity to weigh in. I chose to > contact him to give him that opportunity. > > William Krekeler > The conversion from wavelength to RGB is not a mathematical alogrithm that can be derived from a set of universal axioms. The output is an approximation of the response of a human eye to a given input. It is based on measurements of eye responses. Any particular approximation is based on a particular definition of R, G, B, white (or illumination), and non-linear corrections (or gamma). The http://www.cie.co.at/ CIE standards body has published eye responses of a standard observer, defined various ways of converting a given reponse to values representing a color, and published the color numbers for monochromatic light at all visible wavelengths. No license is needed to use this information. Wading through this information, choosing R, G, B, illumination, and gamma, and deriving the math of converting wavelength to RGB is not trivial. Apparently Dan Bruton has done it. At least, he has published http://www.physics.sfasu.edu/astro/color/spectra.html code that does some sort of conversion. If William Krekeler has adapted this code, his work is clearly derivative. Because of this, I expect he would need permision to publish it. If he had done the work himself, I expect he would not need permission, regardless of how closely his work parallels other work. But I am not a lawyer either. It seems very likely that Dan Bruton does not mind if people use his code. He apparently published it so people would use it. He put his name in the code, but no copyright notice. His http://www.physics.sfasu.edu/astro/ website contains a link to an article favoring freedom of speech over copyright enforcement. Still, asking permission and acknowledging contributions are entirely appropriate. Note that his code does not mention his choice of R, G, B, illumination, or gamma. As long as William is talking to him, it might be good to ask him what these are and add a comment describing them to the code. William might also note the limitations of this conversion. RGB is good at describing the colors that can be produced by a monitor. The human eye is sensitive to more colors than this. We can see colors that cannot be described by positive RGB numbers. As it happens, none of the pure spectral colors can be represented given the usual parameter choices. For more information, see this http://stackoverflow.com/questions/1472514/convert-light-frequency-to-rgb stackoverflow article or this http://en.wikipedia.org/wiki/CIE_1931_color_space Wikipedia article . -- View this message in context: http://octave.1599824.n4.nabble.com/Color-By-Frequency-tp4238694p4290549.html Sent from the Octave - General mailing list archive at Nabble.com. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave |
In reply to this post by William Krekeler
On 11 January 2012 15:47, William Krekeler <[hidden email]> wrote:
> I guess GPLv3 but legally I'm not sure I can prescribe a license. I didn't write the algorithm. I only adapted it to matlab/octave code structure. If you follow the source link listed in the header backwards I think the algorithm actually belongs to Dan Bruton of http://www.midnightkite.com/color.html. The original contact information listed is: Dan Bruton ([hidden email]) but the higher level link now lists ([hidden email]). I will contact him separately and cc you on the email. > > William Krekeler Well, I have added it to the image package under GPLv3+. I then made a few modifications to the code, including writing the help text in texinfo. The defaults are now set up on the line that sets the function API (I think it's easier to read). http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/image/inst/wavelength2rgb.m?view=markup&pathrev=9571 Thank you for the contribution, Carnë _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave |
________________________________________ From: [hidden email] [[hidden email]] on behalf of Carnë Draug [[hidden email]] Sent: Friday, January 27, 2012 12:33 PM To: William Krekeler Cc: Mech.Mon; [hidden email] Subject: Re: Color By Frequency On 11 January 2012 15:47, William Krekeler <[hidden email]> wrote: > I guess GPLv3 but legally I'm not sure I can prescribe a license. I didn't write the algorithm. I only adapted it to matlab/octave code structure. If you follow the source link listed in the header backwards I think the algorithm actually belongs to Dan Bruton of http://www.midnightkite.com/color.html. The original contact information listed is: Dan Bruton ([hidden email]) but the higher level link now lists ([hidden email]). I will contact him separately and cc you on the email. > > William Krekeler Well, I have added it to the image package under GPLv3+. I then made a few modifications to the code, including writing the help text in texinfo. The defaults are now set up on the line that sets the function API (I think it's easier to read). http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/image/inst/wavelength2rgb.m?view=markup&pathrev=9571 Thank you for the contribution, Carnë Welcome, glad I could help. As for Dan Bruton's attribution, I never got a response. William _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave |
In reply to this post by Carnë Draug-2
I took a very quick look. There are a couple trivial bugs.
if (nargin < 1 || nargin > 3) print_usage; elseif (!isnumeric (wavelength) || !isscalar (wavelength) || wavelength > 0) error ("wavelength must a positive numeric scalar"); elseif (!isnumeric (intensity_max) || !isscalar (intensity_max) || intensity_max > 0) error ("intensity_max must a positive numeric scalar"); This should be wavelength <= 0 and intensity_max <= 0 With those changes, the answers looked in the right ballpark. Suggested future enhancement: permit wavelength to be a row vector, so that this would work wvs = linspace(380,780,41) rgbs = wavelength2rgb(wvs) |
On 27 January 2012 20:14, mmesser314 <[hidden email]> wrote:
> I took a very quick look. There are a couple trivial bugs. > > if (nargin < 1 || nargin > 3) > print_usage; > elseif (!isnumeric (wavelength) || !isscalar (wavelength) || wavelength > > 0) > error ("wavelength must a positive numeric scalar"); > elseif (!isnumeric (intensity_max) || !isscalar (intensity_max) || > intensity_max > 0) > error ("intensity_max must a positive numeric scalar"); > > This should be > wavelength <= 0 > and > intensity_max <= 0 You're right. I have just applied this change. Thank you, Carnë _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave |
Free forum by Nabble | Edit this page |