Re: dominant wavelength from an XYZ colour stimulus [message #93401 is a reply to message #93400] |
Mon, 04 July 2016 19:38  |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
On Monday, 4 July 2016 16:32:30 UTC-7, mat.g...@gmail.com wrote:
> I want to calculate the dominant wavelength from an XYZ colour stimulus.
>
> There is a web page which does this:
>
> http://www.brucelindbloom.com/index.html?Equations.html
>
> Does anyone have any code which would do this?
>
> Thanks in advance,
>
> Mat
Hi Mat,
Using Google Chrome, I viewed this page (it's tricky to determine this page's address!):
http://www.brucelindbloom.com/ColorCalculator.html
… and then "View Frame Source" (right-click on the page provided that) showed me the HTML. In there was a link to the JavaScript code at:
http://www.brucelindbloom.com/javascript/ColorConv.js
… where a search for "dominant" gives you two functions that total a few dozen lines that might not be too hard to convert to IDL. (you'll need the lookup arrays, too: CIE1931StdObs_x, CIE1931StdObs_y, CIE1931StdObs_z)
Does that help?
(There's a few formulas in this paper from 25 years ago, but they only work in the expected range of colours of red wine!: https://www.researchgate.net/publication/222642170_Proposal_ of_a_novel_formula_to_calculate_dominant_wavelength_for_colo r_of_red_wines )
(Or, if you prefer tracing through Excel spreadsheets, the XYZtoDom item on this page might do: http://colour4free.org/FrameSpreadsheet.htm )
Cheers,
-Dick
Dick Jackson Software Consulting Inc.
Victoria, BC, Canada --- http://www.d-jackson.com
|
|
|