semmixcolor and perception

Television models YUV and YIQ

Color television had to work on black-and-white sets. The solution was to transmit brightness and two color components separately. The same idea lives on today in every JPEG file and every video, under the name YCbCr.

Why separate brightness from color

Luma Y'

All these models start from luma, a weighted sum of gamma-encoded RGB components (R', G', B'):

Y' = 0.299 R' + 0.587 G' + 0.114 B' (Rec. 601, SD television) Y' = 0.2126 R' + 0.7152 G' + 0.0722 B' (Rec. 709, HD television)

Luma is not luminance: luminance is computed on linear light, luma on gamma-encoded values. The prime in Y' is a reminder of that difference.

YUV (PAL, SECAM)

U = 0.492 · (B' - Y') V = 0.877 · (R' - Y')

U and V are color differences: how far blue and red depart from luma. For a gray both are 0. The coefficients were chosen so the signal fits the range of an analog transmitter.

YIQ (NTSC)

The 1953 NTSC system rotated the UV plane by 33°. The I (in-phase) axis runs roughly from blue to orange, the Q (quadrature) axis from green to purple. The eye resolves more detail along I, so NTSC sent I with a wider bandwidth than Q.

I = 0.596 R' - 0.274 G' - 0.322 B' Q = 0.211 R' - 0.523 G' + 0.312 B'

YCbCr (JPEG, digital video)

The digital version of the same idea. The color differences are scaled and offset into the range of a byte. In JPEG (full range 0..255):

Y = 0.299 R + 0.587 G + 0.114 B Cb = 128 - 0.168736 R - 0.331264 G + 0.5 B Cr = 128 + 0.5 R - 0.418688 G - 0.081312 B

Video usually uses limited range: Y from 16 to 235, Cb and Cr from 16 to 240. Mixing up the ranges gives a washed-out or clipped picture.

Example

RGB (200, 80, 40), #c85028:

R' = 0.7843 G' = 0.3137 B' = 0.1569 Y' = 0.299·0.7843 + 0.587·0.3137 + 0.114·0.1569 = 0.4365 U = 0.492 · (0.1569 - 0.4365) = -0.1376 V = 0.877 · (0.7843 - 0.4365) = 0.3050 I = 0.3310 Q = 0.0504 YCbCr (JPEG): Y = 111.3 Cb = 87.8 Cr = 191.3

Negative U and Cb below 128 mean the color has less blue than its luma would suggest. Large V and Cr above 128 mean red dominates. I is large and Q near zero because orange lies almost on the I axis.

Chroma subsampling

Because the eye sees color detail poorly, Cb and Cr are stored at lower resolution:

SchemeCb, Cr resolutionData relative to 4:4:4
4:4:4full100%
4:2:2half horizontally67%
4:2:0half horizontally and vertically50%

4:2:0 is the standard in JPEG, films and broadcasting. It shows only at sharp edges between saturated colors, for example red text on a blue background.