[comp.windows.x] "intensity" from RGB

stpeters@dawn.UUCP (11/05/88)

> When converting RGB values to monochrome, the sample server(s) compute
> an intensity value as (.39R + .5G + .11B) and assign black if this
> value is less than 50%, white otherwise.  Since green is normally
> defined as (0%, 100%, 0%), it becomes white and (0%, 39%, 39%) becomes
> black.  Other algorithms may be substituted...

I'd like to suggest that (.39R + .5G + .11B) is not a good choice for
"intensity" in the realm of computer graphics.  The formula is from
the (1954) NTSC standard for compatible color TV, and it has built
into it a lot of compromises to accommodate old technology and
problems inherent in the analog transmission of composite color
television.

A better choice in computer graphics is to equally weight the colors:
((R+G+B)/3.0).  Let white be white.

For those interested:

Because color space is three dimensional (example coordinates: RGB),
composite TV must use three different forms of modulation to transmit
three independent information streams on a single carrier.  This is
not even possible in general.

However, there were clever engineers even back then.  Because each TV
scanline differs little from its predecessor, the TV signal is roughly
periodic, which in turn means its spectrum is as well.  A periodic
spectrum is a series of spikes, so before color, the spectrum of a TV
signal when looked at in detail looked like a picket fence.

It is possible to modulate a signal to carry TWO independent streams
of information, using quadrature modulation, so the color guys used
the two chrominance signals to modulate a low-frequency signal and
then used that entire modulated signal to modulate the basic TV
carrier in a way so that the chrominance pickets were in the gaps
between the luminance pickets.  Voila, 3 signals on one TV carrier.

Well, sort of.  The pickets have tails and can get pretty wide if the
scene changes rapidly, so there is always some crosstalk and sometimes
a lot of it.  Things get even hairier when you modulate this onto RF.

Further, not all 3 signals were created equal.  The original signal
is what a B&W TV sees, and it still had to look like a B&W TV signal,
so this "luminance" signal had to be some combination of RGB that was
roughly the "intensity", while what was left over had to be divied up
into two "chrominance" signals.  Various constraints make the
bandwidth for the luminance signal substantially more than the *sum*
of the bandwidths for the two chrominance signals - and the latter
differ by roughly a factor of two.  Just from an information content
point of view, it matters what RGB combinations are used.  NTSC took
all this into account, as well as human eye characteristics.

But they had more to consider.  A B&W TV demodulates the luminance and
uses the resulting signal to control a CRT gun.  However, the CRT
brightness is not linear relative to the luminance signal - in fact,
it is roughly proportional to the *square* of the signal.  Applying
the principle that receivers had to be cheap but transmitters could be
expensive, B&W television applied a correction for this at the
transmitter.  Color TV had to be compatible both ways - not to mention
a need to be inexpensive, so color TV's as well responded to the
square (more or less) of the luminance, and color transmitters had to
apply the same correction ("gamma" correction).

In other words, after the transmitting end divides RGB up into nice
linear combinations, it applies a non-linear transformation.  The
receiver then demodulates the resulting signals, uses linear
recombination to reconstruct "RGB", and applies them to a CRT that
squares them.

The NTSC had to find RGB combinations for luminance and chrominance
that let B&W sets receive color transmissions, color sets receive B&W
transmissions, and color sets receive color transmissions, all within
the limits of 1954 technology and the constraints of analog RF TV.
(We didn't even get to the RF issues.)  They did a marvelous job, but
their formula for intensity is a severe compromise.

--
Dick St.Peters                        
GE Corporate R&D, Schenectady, NY
stpeters@ge-crd.arpa              
uunet!steinmetz!stpeters