[comp.graphics] gray intensity to RGB

majidi@paul.rutgers.edu (Masoud Majidi) (03/28/91)

A while back somebody posted on this newsgroup a mapping from RGB
values to gray intensities. I was wondering if there is a good 
mapping in the reverse direction. If you know how to get RGB values
out of gray intensities I appreciate it if you let me know. (I don't
know if this would make any difference but my images are from body
organs)

Thanks a lot,

Masoud Majidi(majidi@paul.rutgers.edu)

kempkec@mist.CS.ORST.EDU (Christopher Kempke) (03/28/91)

In article <Mar.27.18.06.14.1991.28546@paul.rutgers.edu> majidi@paul.rutgers.edu (Masoud Majidi) writes:
>
>A while back somebody posted on this newsgroup a mapping from RGB
>values to gray intensities. I was wondering if there is a good 
>mapping in the reverse direction. If you know how to get RGB values
>out of gray intensities I appreciate it if you let me know. 

	I don't think this can be done in the general case; the intensity
	value is a combination of three values for the red, green, and
	blue components, something like this:

		Grey = .299 * Red + .587 * Green + .119 * Blue, or 
	
		I = .299r + .587g + .119b for brevity.

	Now, consider an intensity value of .500 (medium grey):  There
	are clearly many mappings back to R, G, and B.  

		R = .10, G = .78, B = .10 or
		R = .20, G = .70, B = .20 or
		any of an infinity of others.

	The possible exception to this is if you knew EXACTLY the palette
	of colors from which the greyscales were derived, in which case
	there MIGHT be a single unique answer to the equation among the
	options available to you.  However, this would work only for a
	relatively small or carefully-picked palette; and is unlikely to
	be true in most situations.

		--Chris