YUV and YIQ (Colorspaces V)

Not all colorspaces are inherently digital, and in fact, most were first conceived as, and for, analog means. Let’s have a look at two of those colorspaces, YUV and YIQ. The YUV colorspace was used for the European analog TV standard, PAL, while YIQ was used for the North American and Japanese standard, NTSC.

The YUV colorspace, like all the others we’ve seen so far, encodes the brightness in the first components and uses two difference components, U and V, that somewhat correspond to the yellow-blue and the red-cyan differences:

\begin{bmatrix}  0.299 & 0.587 & 0.114\\  -0.147 & -0.289 & 0.436\\  0.615 & -0.515 & -0.1\\  \end{bmatrix}  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}  =  \begin{bmatrix}  Y\\  U\\  V\\  \end{bmatrix}

with inverse

\begin{bmatrix}  1 & 0 & 1.340 \\  1 & -0.395 & -0.581\\  1 & 2.032 & 0\\  \end{bmatrix}  \begin{bmatrix}  Y\\  U\\  V\\  \end{bmatrix}  =  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}

In PAL, YUV is sent over the air using a special frequency modulation. The Y component eats the whole band, and carries the black and white image. The U and V components are quadrature amplitude modulated over the Y signal. If decoded for Y only, the signal would only exhibit high-frequency, low amplitude noise, probably unnoticeable in normal viewing conditions.

* *

YIQ is the color space used in NTSC for color encoding. The transform is given by:

\begin{bmatrix}  0.299 & 0.587 & 0.114\\  0.596 & -0.275 & -0.321\\  0.212 & -0.523 & 0.311\\  \end{bmatrix}  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}  =  \begin{bmatrix}  Y\\  I\\  Q\\  \end{bmatrix}

with inverse

\begin{bmatrix}  1 & 0.956 & 0.621\\  1 & -0.272 & -0.647\\  1 & -1.107 & 1.704\\  \end{bmatrix}  \begin{bmatrix}  Y\\  I\\  Q\\  \end{bmatrix}  =  \begin{bmatrix}  r\\  g\\  b\\  \end{bmatrix}

The I and Q components are the red-cyan and yellow-blue differences but rotated -33° around the Y axis, and scaled by what essentially look like magic constants. Why? I am not sure, because I and Q proceed to another encoding stage, the quadrature amplitude modulation (QAM), just as in YUV/PAL. Maybe it was meant to be especially simple in (analog) hardware decoding? That, I’m not very convinced, but I never build a decoder out of analog parts.

* *

The coefficients used in the various colorspace bases (or transforms) seem random, except for some regularities such as the first row that encodes brightness, sometimes with the same coefficients (0.299, 0.587, 0.114), but in fact, there’s a lot more order behind all this. I will close this series of posts with a bird’s eye view of (linear) colorspaces that will explain a lot. Yeah, I’m a tease.

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: