Color Matching (XYZ to RGB)

Last semester I wrote a color matching application for a graphics class (using C# and XNA — XNA only for rendering the output texture, which is a kind of overkill, but no matter). I’ll let Wikipedia describe the CIE color space, the eye, color vision and so on — I definitely wouldn’t do these topics justice. But the general idea is, that in order to display a sample of light on a computer monitor, we have to convert the spectral values to RGB values.

For this project, I was supplied spectral values for the Macbeth Color Checker. These were stored in a comma-delimited text file with wavelengths samples between 380 and 780 nanometers in 5nm increments. Using the CIE 1964 color space (also stored in a text file and in 5nm increments between 360 and 830nm), and NTSC chromaticity coordinates:

R 0.67 0.33
G 0.21 0.71
B 0.14 0.08
White Point 0.313 0.329

we can go from spectrum samples –> XYZ coordinates –> RGB.


The output is a reproduction of the color checker as a set of 24 textures. The coding is pretty straight forward, and I’ve included it here . Kind of an obscure topic, but i hope it comes in handy for someone :)


No Comment

No comments yet

Leave a reply