1) The afine transformation in colour space : [R G B] -> [Y Cb Cr]

---------------------------------------------------------------------

(It is defined in the CCIR Recommendation 601)

(R,G,B are 8-bit unsigned values)

| Y | | 0.299 0.587 0.114 | | R | | 0 |

| Cb | = |- 0.1687 - 0.3313 0.5 | * | G | + |128|

| Cr | | 0.5 - 0.4187 - 0.0813| | B | |128|

The new value Y = 0.299*R + 0.587*G + 0.114*B is called the luminance.

It is the value used by the monochrome monitors to represent an RGB colour.

Physiologically, it represents the intensity of an RGB colour perceived by

the eye.

You see that the formula for Y it's like a weighted-filter with different weights

for each spectral component: the eye is most sensitive to the Green component

then it follows the Red component and the last is the Blue component.

The values Cb = - 0.1687*R - 0.3313*G + 0.5 *B + 128

Cr = 0.5 *R - 0.4187*G - 0.0813*B + 128

are called the chromimance values and represent 2 coordinates in a system

which measures the nuance and saturation of the colour ([Approximately], these

values indicate how much blue and how much red is in that colour).

These 2 coordinates are called shortly the chrominance.

[Y,Cb,Cr] to [R,G,B] Conversion (The inverse of the previous transform)

--------------------------------

RGB can be computed directly from YCbCr ( 8-bit unsigned values) as follows:

R = Y + 1.402 *(Cr-128)

G = Y - 0.34414*(Cb-128) - 0.71414*(Cr-128)

B = Y + 1.772 *(Cb-128)