# Visible light spectrum to color space

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?

-
 – Colin K Dec 21 '11 at 0:31 Also, this is a classic optics homework question. – Colin K Dec 21 '11 at 0:31 This isn't homework and I'm not an optic physics student, I just happened to need to solve this problem and needed some guidance because I didn't understand what I found online via google. Thanks for the link to the question though. – Thomas Dec 21 '11 at 0:53 White light is not a flat spectrum, it's whatever our eyes perceive as white. White is typically modeled by “standard illuminants”, such as D65 or D50, which mimic average daylight or sunlight spectra. – Edgar Bonet Dec 21 '11 at 9:04

$$R = \int_{0}^{+\infty} S_R(\lambda) P(\lambda) d\lambda$$ $$G = \int_{0}^{+\infty} S_G(\lambda) P(\lambda) d\lambda$$ $$B = \int_{0}^{+\infty} S_B(\lambda) P(\lambda) d\lambda$$