Path: utzoo!attcan!uunet!husc6!bloom-beacon!SUN.COM!poynton From: poynton@SUN.COM (Charles Poynton) Newsgroups: comp.windows.x Subject: Luminance from RGB (was "intensity" from RGB) Message-ID: <8811070533.AA08904@vector.sun.com> Date: 7 Nov 88 05:33:23 GMT References: <8811011523.AA02242@LYRE.MIT.EDU> <8811042303.AA21505@dawn.steinmetz.GE.COM> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 159 Excuse the re-post, the first posting was returned by a mailer at MIT so I think they missed it. In Comp.windows.x article <8811011523.AA02242@LYRE.MIT.EDU>, Ralph R. Swick comments: > When converting RGB values to monochrome, the sample server(s) compute > an intensity value as (.39R + .5G + .11B) ... (.39R + .5G + .11B) is apparently incorrect. This set could be a typographical error (from .29R + .6G + .11B ?), a liberal approximation, or perhaps an unusual phosphor set. Could someone enlighten me on this? In followup article <8811042303.AA21505@dawn.steinmetz.GE.COM>, Dick St.Peters makes the statement: > I'd like to suggest that (.39R + .5G + .11B) is not a good choice for > "intensity" in the realm of computer graphics. ... > > A better choice in computer graphics is to equally weight the colors: > ((R+G+B)/3.0). Let white be white. Equal weighting of the primaries is NOT the right thing to do, unless the viewers of your images are members of some species that has uniform response across the visible spectrum, unlike homo sapiens. Humans see 1 watt of green light energy as being somewhat brighter than 1 watt of red, and very much brighter than 1 watt of blue. The science of colourimetry began to flourish in 1931, when the CIE standardized a statistical entity called the "standard observer". This includes a standard spectral luminance response defined numerically as a function of wavelength. It is from this data that the factors which are used in colour television are derived: .587 for green, .299 for red, and .114 for blue. The particular factors depend on the wavelengths or chromaticities that you call red, green, and blue: there is wide disparity in these choices. For computer graphics and television, the luminance factors depend on the chromaticity coordinates of the phosphors of your CRT. There are compromises in the choice of phosphor primaries, but it turns out that the NTSC did a spectacularly good job of selecting primaries. The luminance coefficients 0.299 for red, 0.114 for blue, and 0.587 for green are unquestionably the best values to use, unless you know your phoshphors intimately. The second article continues, > 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. Contrary to this assertion, the ONLY compromise in NTSC which impacts the luminance equation is the choice of reference phosphor chromaticities, and a choice of phosphors MUST be made for any system which transmits colour in RGB. Just because it's old (1954) doesn't mean we should throw it away. Aside from this, the discussion of television coding which follows is substantially correct, except that modulation onto an RF carrier for transmission involves no inherent compromises beyond those already made in formation of baseband NTSC. (Receivers frequently make their own compromises, but these are not inherent.) For those interested, I attach an alternate description of television coding. Charles Poynton "No quote. poynton@sun.com No disclaimer." (415)336-7846 ----- GAMMA CORRECTION A picture tube (CRT) produces a light output which is proportional to its input voltage raised to approximately the 2.5-th power. Rather than requiring circuitry to implement the 2.5-th root function to compensate for this be implemented at every receiver, the "gamma correction" is performed on the R, G, and B primaries at the camera to form signals denoted R', G', and B'. YUV REPRESENTATION (3 wires) Studio equipment typically processes colour signals in three components YUV, which are easily derived from RGB. The Y channel contains the luminance (black-and-white) content of the image, and is computed as: Y' = 0.299 R' + 0.587 G' + 0.114 B' "Colour difference" signals U and V are scaled versions of B'-Y' and R'-Y' respectively; these vanish for monochrome (grey) signals. The human visual system has much less acuity for spatial variation of colour than for luminance, and the advantage of U and V components is that each can be conveyed with substantially less bandwidth than luminance, R or G or B. In analog YUV studio systems, U and V each have a bandwidth of 1.5 MHz, compared to between 4.2 MHz and 5.5 MHz for luminance. In digital systems, U and V are each horizontally subsampled by a factor of two (i.e. conveyed at half the rate of the luminance signal). Y/C REPRESENTATION (2 wires) U and V can be combined easily into a "chroma" signal which is conveyed as modulation of a continuous 3.58 MHz sine-wave subcarrier. Subcarrier phase is decoded with reference to a sample or "burst" of the 3.58 MHz continuous-wave subcarrier which is transmitted during the horizontal blanking interval. The phase of the chroma signal conveys a quantity related to hue, and its amplitude conveys a quantity related to colour saturation (purity). The "S" connectors of S-VHS and ED-Beta equipment simply carry Y and C on separate wires. This coding is easily decoded without artifacts. Current S-VHS equipment conveys chroma with severely limited bandwidth, about 300 kHz (which is just 16 cycles of U or V per picture width). Consumer VCR equipment has always recorded the luminance and chroma components separately on tape, but only since the introduction of the S-connector in S-VHS and ED-Beta equipment has the consumer been able to take advantage of this capability. NTSC REPRESENTATION (1 wire) The NTSC system mixes Y and C together and conveys the result on one piece of wire. The result of this addition operation is not theoretically reversible: the process of separating luminance and colour often confuses one for the other. Cross-colour artifacts result from luminance patterns which happen to generate signals near the 3.58 MHz colour subcarrier. Such information may be decoded as swirling colour rainbows. Cross-luminance artifacts result if modulated colour information is incorrectly decoded as crawling or hanging luminance dots. It is these artifacts which can be avoided by using the S-connector interface. In general, once the NTSC footprint is impressed on a signal, it persists even if subsequent processing is performed in RGB or YUV components. Encoded NTSC signals can be sampled into a stream of 8-bit bytes. Such "composite digital" systems have the advantage of using slightly less memory than component systems, at the expense of the dreaded NTSC artifacts. Manipulation of such composite signals to perform operations such as shrinking the picture is difficult or impossible, because if the colour subcarrier frequency is altered the colour information in the signal is destroyed. Therefore, these operations are performed in the component domain. FREQUENCY INTERLEAVING The NTSC colour subcarrier frequency is chosen to be exactly 455/2 times the line rate of 9/.572 kHz. The fact that the subcarrier frequency is an odd multiple of half the line rate causes colour information to be interleaved with the luminance spectrum: if a portion of a coloured region has a positive-going modulated chroma component on one scan line, then on the next line chroma will go negative. This property allows the use of a "comb filter" to separate luminance and chroma. The signal is delayed by one total line time, in order that two vertically adjacent picture elements be available to the electronics at the same instant in time. Forming the sum of these two elements will produces luminance, and forming their difference produces the modulated chroma. This feature results in greatly improved luma/chroma separation compared to a 3.58 MHz "trap" filter. However, a comb filter assumes a fair degree of vertical correlation in the picture, and this assumption does not hold for pictures with great vertical detail. -----