I need to be able to convert an arbitrary emission spectrum in the visible spectrum range (i.e. for every wavelength between 380 and 780, I have a number between 0 and 1 that represents the "intensity" or dominance of that wavelength), and I need to be able to map any given spectrum into a particular color space (for now I need RGB or CIE-XYZ). Is it possible?
For the spectrum say I have the emission spectrum of a white light, then every wavelength in the spectrum will have an intensity of 1, whereas for a green-bluish light I'd have most of the wavelengths between 500 and 550 with an intensity close to 1, with other wavelengths gradually dropping in intensity. So the first spectrum should be converted to pure white whereas the other one would be converted to a green-bluish color in any color space.
Is there a way to do this?
Answer
Human eye has three types of color receptors which respond differently to different parts of the spectrum. See this chart.
One way to tackle your challenge is to basically simulate what the eye does: you take the spectrum as input, calculate how much it would excite each of the three color receptors based on their sensitivity to different parts of the spectrum and then use the three resulting numbers as RGB corresponding to the spectrum.
In order to compute the excitation level, you can integrate the product of the sensitivity SC(λ) of each of the three color receptors with your spectral power distribution P(λ) to obtain the three RGB numbers:
\begin{equation} R = \int_{0}^{+\infty} S_R(\lambda) P(\lambda) d\lambda \end{equation} \begin{equation} G = \int_{0}^{+\infty} S_G(\lambda) P(\lambda) d\lambda \end{equation} \begin{equation} B = \int_{0}^{+\infty} S_B(\lambda) P(\lambda) d\lambda \end{equation}
For prototyping you can probably just assume the sensitivity SC(λ) functions to be appropriately scaled and translated Gaussian functions of the wavelength. As you refine your model you should seek better sensitivity functions for each of the three types of color receptors.
No comments:
Post a Comment