Converter Comprimento de Onda em RGB
Converter Comprimento de Onda em RGB
Converter Comprimento de Onda em RGB
# intensity correction if w >= 380 and w < 420: SSS = 0.3 + 0.7*(w - 350) / (420 - 350) elif w >= 420 and w <= 700: SSS = 1.0 elif w > 700 and w <= 780: SSS = 0.3 + 0.7*(780 - w) / (780 - 700) else: SSS = 0.0 SSS *= 255 return [int(SSS*R), int(SSS*G), int(SSS*B)]
The output value's range is 0 -- 255. The code could use some streamlining, but even in this form it is fast enough for an occasional image. Here is whole visible spectrum as made by this function:
Finally, in case you want to read more about computer colour science: Rendering spectra Colour Rendering of Spectra Posted by R.L. at 7:28 PM Labels: images, Python