From: lilleyc@cs.man.ac.uk (Chris Lilley)
Newsgroups: alt.graphics.pixutils
Subject: Re: why ".299 r + .587 g + .114 b" ??
Date: 15 Oct 92 20:51:25 GMT
Organization: Dept Computer Science, University of Manchester, U.K.

In article <1992Oct14.205135.27479@kakwa.ucs.ualberta.ca>
sherwood@fenris.space.ualberta.ca (Sherwood Botsford) writes: 

>Huei-Ping Chen writes

>> there is a function ppmtopgm which converts color  
>pictures to grayscale,
>> the man page says the quantization formula used is ".299  
>r + .587 g + .114 b".
>> 
>> my question is why this formular, is there any color  
>theory behind it ??

>The formula was arrived at empirically.  Human eye is most  
>sensative to green light. Hence the high green value.  You  
>want contrast between sky and land, hence low blue value.   
>I've no idea how they can claim 3 place accuracy however.

>Not a complete answer.  Flame me if I'm wrong on the  
>details.

Well not a flame, but yes it is completely wrong I'm afraid.

The formula is that used in the American NTSC television standard to
compute the luminance part of the YIQ encoding/compression used to
produce broadcast TV signals. The TV set reverses the process to
display the picture.

Originally, the luminance corresponded to the brightness of a colour
displayed on an NTSC standard broadcast monitor, once the RGB values
had been gamma corrected with a value of 2.2 so that the (originaly
linear) RGB values gave linear light output from the monitor
phosphors.

Over the course of time, TVs got to be made differently and colour
balance is now most often done on a SMPTE broadcast monitor. This
corresponds more closely to modern TV sets. The actual encoding to
YIQ still uses the same formulae, of course, because all those
millions of TV sets would need changed if they used a new formula...
so now, the luminance and chrominance components of the broadcast
signal are not as optimal at using the available bandwidth as they
were.

So the short answer is, if you apply a fixed 2.2 gamma correction to
your RGB values first, then the .299 r + .587 g + .114 b formula will
give you the luminance that would be measured on a 1950s colour TV
set. Not a whole lot of use.  And the PBM utility does not apply the
gamma correction first, either.

To give an idea of the differences between monitors, here are some values:

 .299 r + .587 g + .114 b	NTSC broadcast std monitor
 .222 r + .707 g + .071 b	European (EBU) broadcast std monitor
 .212 r + .701 g + .087 b	SMPTE broadcast std monitor
 .179 r + .730 g + .091 b	VAXstation 24 bit monitor
 .211 r + .686 g + .102 b	HP 9000/730 24 bit monitor

As these values are calculated from the chromaticities of the monitor
phosphors, which are directly measurable with the appropriate meter,
that explains why they give 3 (or 4) figures of accuracy.

To get a feel for the effect of gamma correction, just make a table
with 10 or so entries between 0.0 and 1.0  In the second column, put
the first column entry to the power (1/2.2). If it helps, scale these
two columns up to 0 .. 255 if that is how you see RGB values. Compare.
The effect is _not_ subtle.


--
Chris Lilley
---------------------------------------------------------------------------
Technical Author, ITTI Computer Graphics and Visualisation Training Project
Computer Graphics Unit, Manchester Computing Centre, Manchester, UK
Internet:   lilley@cgu.mcc.ac.uk        Janet:   lilley@uk.ac.mcc.cgu
Voice:      +44 (0)61 275 6095          Fax:     +44 (0)61 275 6040
---------------------------------------------------------------------------