[comp.graphics] RGB to CIE conversion

mike@raster.UUCP (Mike Guravage) (05/10/88)

Has anyone got either pseudo code or C routines
for converting RGB to CIE and back again?


Michael A. Guravage
Raster Technologies Inc.
Two Robbins Road
Westford, MA  01886
(617) 692-7900 x270
UUCP: decvax!raster!mike

chris@hpcilzb.HP.COM (Chris Toomey) (05/18/88)

The formulas for converting from RGB coordinates to CIE XYZ coordinates depend 
on the chromaticity coords. of the primaries and alignment white of the 
monitor being used. The National Television System Committee (NTSC) has
adopted the following standard primaries and white for color television:
		x	y
	Red	0.67	0.33
	Green	0.21	0.71
	Blue	0.14	0.08
	White	0.31	0.316
For a color monitor following using these primaries, the conversion formulas
are as follows:
	X = 0.608R + 0.174G + 0.200B
	Y = 0.299R + 0.587G + 0.114B
	Z = 0.000R + 0.0662G + 1.112B
For going back to RGB coordinates, the formulas are:
	R = 1.910X - 0.532Y - 0.288Z
	G = -0.982X + 2.00Y - 0.0283Z
	B = 0.0585X - 0.119Y + 0.900Z

As I said, however, these equations are valid only for a monitor whose       
primaries and reference white have the chromaticity coords. listed above. 

The more general eqns. from which the above sets of eqns. were derived can be 
found in the following references:
	Bingley, F. J. "Colorimetry in Color Television - Part II." Proceed-
	ings of the I. R. E. vol. 48 (Jan. 1954), pp. 48-51.

	Conrac Div., Conrac Corp. Raster Graphics Handbook. 2nd Edition. Van
	Nostrand Reinhold Co., New York, 1985.

More general coverage of television colorimetry can be found in this book:
	Hazeltine Laboratories Staff. Principles of Color Television. John
	Wiley and Sons, Inc., New York, 1956.

Chris Toomey