POV-Ray : Newsgroups : povray.advanced-users : Spectral data -> XYZ : Spectral data -> XYZ Server Time
29 Jul 2024 02:20:12 EDT (-0400)
  Spectral data -> XYZ  
From: Matti Karnaattu
Date: 25 Mar 2003 19:20:04
Message: <web.3e80f0b531078484bef0bd7d0@news.povray.org>
How can I convert spectral data to CIE XYZ components?

I calculate definite integral of spectrum multiplying spectrum values CIE
1931 color matching functions and then divide X, Y, Z -integrals with
(X+Y+Z). Then I calculate chromaticity coordinates from XYZ components and
compare these chromaticity coordinates to real chromaticity coordinates of
spectral data what I use to test code. My code gives wrong results and I
like to know what I do wrong.

I got spectral data with calculated chromaticity coordinates here:

http://www.cs.utah.edu/~bes/graphics/spectra/


And here is the critical part of code. cie_x, cie_y, cie_z and spectrum are
all natural splines.

---

#declare WaveLength = StartWaveLength;
#while (WaveLength <= EndWaveLength)
  #declare X = X + cie_x(WaveLength) * spectrum(WaveLength);
  #declare Y = Y + cie_y(WaveLength) * spectrum(WaveLength);
  #declare Z = Z + cie_z(WaveLength) * spectrum(WaveLength);
    * spectrum(WaveLength);

  #declare WaveLength = WaveLength + 1;
#end

#declare xyz = X.x + Y.x + Z.x;

#declare X = X / xyz;
#declare Y = y / xyz;
#declare Z = Z / xyz;

---

Matti


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.