Spazi di Colore / Color spaces

The collection of conversion matrix can be found here. Take care. This page is always a work in progress.

RGB

RGB is perhaps the simplest color space for us to understand. As stated above, using proportions of red, green, and blue that are scaled to a minimum and maximum values for each component (for example, 0x00 through 0xFF, or 0.0 through 1.0), most colors in the visible spectrum can be recreated, although not completely. This scheme is based on the additive properties of color.

CMY(K)

CMY (cyan, magenta, yellow) is the basic color space used when applying colors to media printed on a white background (such as paper). It is based on the subtractive properties of color, which is caused by wavelength absorption. For example, the color yellow appears yellow because yellow objects absorb blue, and reflect red and green.
When CMY colors are added, the subtractive properties are compounded. An example of this would be obtaining the color blue in CMY space. You basically want to absorb everything but blue (red and green). Green and red are absorbed by cyan and magenta, respectively. The resulting vector becomes <1,1,0>.

The ideal general equation (with normalized vector components) for translating between CMY and RGB is the following:

C = 1 - R
M = 1 - G
Y = 1 - B


There is also a very closely related color space known as CMYK, for which there exists the fourth component K, which is pure black. This color space is useful in printing, where K can be mixed into the CMY inks to produce a much darker black than could be produced by saturating the paper with ridiculous amounts of cyan, magenta, and yellow. The mixing function is:

K = minimum(C,M,Y)
C = C - K
M = M - K
Y = Y - K

CIE XYZ

CIE (Commission Internationale de L'Eclairage) XYZ is a complete model developed in 1931 that can recreate all colors in the visible spectrum. XYZ defines virtual primarycolors X, Y, and Z, which are the wavelengths that the rods and cones in the human eye are most sensitive to. The Y primary was specifically designed to follow the luminous efficiency function of human eyes.

CIE L*a*b*

In 1976 the CIE created a refined model of XYZ called L*a*b*. In L*a*b*, L is the luminance, a* is a value for which -a* is green, and +a* is red, b* is a value for which -b* is blue, and +b* is yellow.
Use the following formular to convert from CIE XYZ to CIE L*a*b*:

L* = -16 + 116 * (pow(Y / Yn), 1/3)
a* = 500 * (pow(X / Xn, 1/3) - pow(Y / Yn, 1/3)
b* = 200 * (pow(Y / Yn, 1/3) - pow(Z / Zn, 1/3)
where X,Y,Z exist on the scale of 0,0,0 to Xn,Yn,Zn.

HLS(HSB,HSV)

HLS stands for hue, lightness (luminence), and saturation.
Luminence is the brightness of the color - the intensity.

Hue is the shift in the dominant wavelength of a spectral distribution.

Saturation is the concentration of a spectral distribution at one wavelength.

HLS is in the same class of color spaces as HSB, and HSV. The brightness computation is the only difference.

YUV

Originally used for PAL (European "standard") analog video, YUV is based on the CIE Y primary, and also chrominance. Chrominance is the difference between a color and a reference white at the same luminance.
To convert from RGB to YUV spaces, the following equations can be used:

Y = 0.299 R + 0.587 G + 0.114 B
U = 0.492 (B - Y)
V = 0.877 (R - Y)

Additional information on YUV color space can be found here[In italian].

YCrCb

YCrCb is a subset of YUV that scales and shifts the chrominance values into the range of 0..1:
Y = 0.299 R + 0.587 G + 0.114 B
Cr = ((B-Y)/2) + 0.5
Cb = ((R-Y)/1.6) + 0.5

 

YIQ

YIQ is used in the US television standard, NTSC. It is similar to YUV, except that its colorspace is rotated 33 degrees clockwise, so that I is the orange-blue axis, and Q is the purple-green axis. The equations to convert from RGB to YIQ are:
Y = 0.299 R + 0.587 G + 0.114 B
I = 0.74 (R - Y) - 0.27 (B - Y) = 0.596 R - 0.275 G - 0.321 B
Q = 0.48 (R - Y) + 0.41 (B - Y) = 0.212 R - 0.523 G + 0.311 B

References:

Dunn S. "CS563 Digital Color"

Pirazzi, C., "The Pixel Rosetta Stone: Packings and Colorspaces,"

Li, Ze-Nian, "CMPT 365 Multimedia Systems '98,"