Jump to content

Y′UV

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by (3ucky(3all (talk | contribs) at 16:40, 28 June 2006 (added YUV to RGB conversion (from matrix inversion), some minor formatting). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Example of U-V color plane, Y value = 0.5, represented within RGB color gamut
Larger version

The YUV model defines a color space in terms of one luminance and two chrominance components. YUV is used in the PAL and NTSC systems of television broadcasting, which are the standards in much of the world.

YUV models human perception of color more closely than the standard RGB model used in computer graphics hardware, but not as closely as the HSL color space and HSV color space.

Y stands for the luminance component (the brightness) and U and V are the chrominance (color) components. The YCbCr or YPbPr color space, used in component video, is derived from it (Cb/Pb and Cr/Pr are simply scaled versions of U and V), and is sometimes inaccurately called "YUV". The YIQ color space used in the NTSC television broadcasting system is related to it, although in a more complex way.

Formulas

YUV signals are created from an original RGB (red, green and blue) source. The weighted values of R, G and B are added together to produce a single Y signal, representing the overall brightness, or luminance, of that spot. The U signal is then created by subtracting the Y from the blue signal of the original RGB, and then scaling; and V by subtracting the Y from the red, and then scaling by a different factor. This can be accomplished easily with analog circuitry.

These formulae approximate the conversion between the RGB color space and YUV.

From RGB to YUV:

From YUV to RGB:

Or, using a matrix representation:

Two things to note regarding the RGB transformation matrix:

  • The top row is identical to that of the YIQ color space
  • If then . In other words, the top row coefficients sum to unity and the last two rows sum to zero.

Note: this formula uses the more traditional model of YUV, which is used for PAL equipment; NTSC HDTV uses a slightly different formula with R=0.21, G=0.71, and B=0.07.

As most actual uses of RGB->YUV are in integer math, it's often convenient to use a fixed-point approximation.

Y := min(abs(r * 2104 + g * 4130 + b * 802 + 4096 + 131072) >> 13, 235)
U := min(abs(r * -1214 + g * -2384 + b * 3598 + 4096 + 1048576) >> 13, 240)
V := min(abs(r * 3598 + g * -3013 + b * -585 + 4096 + 1048576) >> 13, 240)

Luminance/chrominance systems in general

The primary advantages of luminance/chrominance systems such as YUV, and its relatives YIQ and YDbDr, are that they remain compatible with black and white analog television (largely due to the work of Georges Valensi). The Y channel saves nearly all the data recorded by black and white cameras, so it produces a signal suitable for reception on old monochrome displays. In this case, the U and V are simply discarded. If displaying color, all three channels are used, and the original RGB information can be decoded.

Another advantage of YUV is that some of the information can be discarded in order to reduce bandwidth. The human eye has fairly little color sensitivity: the accuracy of the brightness information of the luminance channel has far more impact on the image discerned than that of the other two. Understanding this human shortcoming, standards such as NTSC reduce the amount of data consumed by the chrominance channels considerably, leaving the eye to extrapolate much of the color. NTSC saves only 11% of the original blue and 30% of the red. The green information is usually preserved in the Y channel. Therefore, the resulting U and V signals can be substantially compressed.

However, this colorspace conversion is lossy. When the NTSC standard was created in the 1950s this was not a real concern since the quality of the image was limited by the monitor equipment, not the compressed signal being received. However today's modern television is capable of displaying more information than is contained in these lossy signals. To keep pace with the abilities of new technology, attempts have been made to preserve more of the YUV signal while recording images, such as S-Video on VCRs and DVD players. YUV was also used as the standard format for common video compression algorithms such as MPEG-2. Digital television and DVDs preserve their compressed video streams in the MPEG-2 format, which uses a full YUV color space. The professional CCIR 601 uncompressed digital video format also uses YUV, primarily for compatibility with previous analog video standards. This stream can be easily mixed into any output format needed.

YUV is not an absolute color space. It is a way of encoding RGB information, and the actual color displayed depends on the actual RGB colorants used to display the signal. Therefore a value expressed as YUV is only predictable if standard RGB colorants are used.

Types of sampling

To get a digital signal, YUV images can be sampled in several different ways; see chroma subsampling.

See also