The big picture (Colorspaces VIII)

A few posts ago, I said that while the colorspaces looked random, they really weren’t, and that there was underlying order. The structure cannot be easily seen just by looking at the numbers themselves, but at how the numbers are obtained.

The story begins sometimes in the 1950s, were transmitting color TV images started to be the next logical step. Someone (not sure who was first, but it may have been Valensi, in the 1930s) proposed that TV color should be encoded in a perceptually friendly way [1]. It was known for a while that the retina had four types of sensors, rods for brightness with no color information, and three other types corresponding to red, green, and blue, but also that in, and beyond the retina, information travels as brightness, yellow-blue and red-green differences [2,3].

Inspired by the eye, the color camera sensors would be composed of red, green, and blue sensors—but no brightness sensors; brightness would have to be synthesized. The weights assigned to each color were set to:

w_R=0.299

w_G=0.587

w_B=0.114

The transmission primaries were chosen to be

\begin{bmatrix}  w_R & w_G & w_B\\  1-w_R & -w_G & -w_B\\  -w_R & -w_G & 1-w_B\\  \end{bmatrix}  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}  =  \begin{bmatrix}  Y\\  P_1\\  P_2\\  \end{bmatrix}

P_1 is more or less a red-cyan difference and P_2 is the yellow-blue difference. If we swap the last two rows, we get the (Kodak) YCC colorspace:

\begin{bmatrix}  w_R & w_G & w_B\\  -w_R & -w_G & 1-w_B\\  1-w_R & -w_G & -w_B\\  \end{bmatrix}  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}  =  \begin{bmatrix}  Y\\  C_1\\  C_2\\  \end{bmatrix}

YUV, YDbDr, YIQ, and YCbCr can be easily derived from YCC.

Let

w_Y=1

\displaystyle w_U=\frac{U_{max}}{1-w_B}

\displaystyle w_V=\frac{V_{max}}{1-w_R}

where U_{max}=0.436 and V_{max}=0.615 are two magic constants (I haven’t found why exactly they were chosen).

Then YUV is

\begin{bmatrix}  w_Y & 0 & 0\\  0 & w_U & 0\\  0 & 0 & w_V\\  \end{bmatrix}  \begin{bmatrix}  w_R & w_G & w_B\\  -w_R & -w_G & 1-w_B\\  1-w_R & -w_G & -w_B\\  \end{bmatrix}  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}  =  \begin{bmatrix}  Y\\  U\\  V\\  \end{bmatrix}

YDbDr is

\begin{bmatrix}  1 & 0 & 0\\  0 & \frac{4}{3(1-w_B)} & 0\\  0 & 0 & \frac{4}{3(1-w_R)}\\  \end{bmatrix}  \begin{bmatrix}  w_R & w_G & w_B\\  -w_R & -w_G & 1-w_B\\  1-w_R & -w_G & -w_B\\  \end{bmatrix}  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}  =  \begin{bmatrix}  Y\\  D_B\\  D_R\\  \end{bmatrix}

and YCbCr is

\begin{bmatrix}  1 & 0 & 0\\  0 & \frac{1}{2(1-w_B)} & 0\\  0 & 0 & \frac{1}{2(1-w_R)}\\  \end{bmatrix}  \begin{bmatrix}  w_R & w_G & w_B\\  -w_R & -w_G & 1-w_B\\  1-w_R & -w_G & -w_B\\  \end{bmatrix}  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}  =  \begin{bmatrix}  Y\\  C_B\\  C_R\\  \end{bmatrix}

YIQ is a bit more complicated, because there’s an extra rotation, and starts from the transmission primaries, not YCC:

\begin{bmatrix}  1 & 0 & 0\\  0 & \cos 33^{\circ} & -\sin 33^{\circ}\\  0 & \sin 33^{\circ} & \cos 33^{\circ}\\  \end{bmatrix}  \begin{bmatrix}  w_Y & 0 & 0\\  0 & w_V & 0\\  0 & 0 & w_U\\  \end{bmatrix}  \begin{bmatrix}  w_R & w_G & w_B\\  1-w_R & -w_G & -w_B\\  -w_R & -w_G & 1-w_B\\  \end{bmatrix}  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}  =  \begin{bmatrix}  Y\\  I\\  Q\\  \end{bmatrix}

*
* *

All the “analog” colorspaces are strongly filiated and this is made clear when we express them in terms of matrix products instead of just numerical matrices. The same is true for the BT.709 and BT.2020 colorspaces, except that they use 0.2126, 0.7152, and 0.0722 to weight red, green, and blue.


[1] Harold E. Ennes — Television Broadcasting: Equipment, Systems, and Operating Fundamentals — Howard W. Sams & Co (1971)

[2] R Steven Turner — In the Eye’s Mind: Vision and the Helmholtz-Hering Controversy — Princeton University Press (1994)

[3] M. A. Ali, M. A. Klyne — VIsion in Vertebrates — Springer-Verlag (1985)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: