1 introduction to color spaces author: chik-yau foo e-mail: [email protected] mobile phone:...
TRANSCRIPT
1
Introduction to Color Spaces
Author: Chik-Yau Foo
E-mail: [email protected]
Mobile phone: 0920-767-580v030305
Presenter: Wei-Cheng LinE-mail: [email protected] Phone: 0912-808-362
2
The EM Spectrum
103
100
10-3
10-6
10-9
10-12
106
109
1012
1015
1018
1021
Wavele
ngth
(m
)
Frequency
(H
z) Long-wave radio
Short-wave radio
TV
Microwave
Infrared
Ultraviolet
X-rays
Gamma rays
Cosmic rays
Visible spectrum
Only a small part of the EM* spectrum is visible to us. This part is known as the
visible spectrum. Wavelength in the region
of 380 nm to 750 nm.
*Electro-Magnetic
3
Light and the Human Eye When we focus on an image, light from the image
enters the eye through the cornea and the pupil.
The light is focused by the lens onto the retina.
Lens
Pupil
Cornea
Iris
Retina
Opticnerve
Fovea
4
Rods and Cones
When light reaches the retina, one of two kinds of light sensitive cells are activated.
These cells, called rods and cones, translate the image into electrical signals.
The electrical signals are transmitted through the optical nerve, and to the brain, where we will perceive the image.
light
ConeRod
Retina
5
Rods: Twilight Vision 130 million rod cells per eye.
1000 times more sensitive to light than cone cells.
Most to green light (about 550-555 nm), but with a broad range of response throughout the visible spectrum.
Produces relatively blurred images, and in shades of gray.
Pure rod vision is also called twilight vision.
Relative neural response of rods as a function of light wavelength.
400 500 600 700Wavelength (nm)
1.00
0.75
0.50
0.25
0.00
Rela
tive r
esp
onse
6
Cones: Color Vision 7 million cone cells per eye.
Three types of cones* (S, M, L), each "tuned" to different maximum responses at:-
S : 430 nm (blue) (2%)
M: 535 nm (green) (33%)
L : 590 nm (red) (65%)
Produces sharp, color images.
Pure cone vision is called photopic or color vision.
Spectral absorption of light by the three cone types
400 500 600 700Wavelength (nm)
1.00
0.75
0.50
0.25
0.00
Rela
tive a
bso
rbti
on
S M L
*S = Short wavelength cone M = Medium wavelength cone L = Long wavelength cone
7
Rod vision Cone vision
Photopic vs Twilight Vision There are about 20x more rods than cones in the
eyes, but rod vision is poorer than cone vision.
This is because rods are distributed all over the retina, while cones are concentrated in the fovea.
Rod vision Cone vision
130 million rods
7 million cones
8
Eye Color Sensitivity Although cone response
is similar for the L, M, and S cones, the number of the different types of cones vary.
L:M:S = 40:20:1 Cone responses typically
overlap for any given stimulus, especially for the M-L cones.
The human eye is most sensitive to green light.
Spectral absorption of light by the three cone types
400 500 600 700Wavelength (nm)
1.00
0.75
0.50
0.25
0.00
Rela
tive a
bso
rbti
on
S M L
S, M, and L cone distribution in the fovea
Effective sensitivity of cones (log plot)
400 500 600 700Wavelength (nm)
1.00
0.1
0.01
0.001
0.0001
Rela
tive s
ensi
tivit
y
S
M L
9
Theory of Trichromatic Vision The principle that the color
you see depends on signals from the three types of cones (L, M, S).
The principle that visible color can be mapped in terms of the three colors (R, G, B) is called trichromacy.
The three numbers used to represent the different intensities of red, green, and blue needed are called tristimulus values.
=
Tristimulus values
r g b
10
Seeing Colors The colors we perceive
depends on:-Illumination
source
Illumination sourceObject
reflectancefactor
Object reflectance
Observerspectral
sensitivity
Observer response
Observerresponse
=
Tristimulus values(Viewer response)
r g b
x
x
The product of these three factors will produce the sensation of color.
11
Additive Colors Start with Black – absence of any
colors. The more colors added, the brighter it gets.
Color formation by the addition of Red, Green, and Blue, the three primary colors
Examples of additive color usage:- Human eye Lighting Color monitors Color video cameras Additive color wheel
12
Subtractive Colors Starts with a white background
(usually paper).
Use Cyan, Magenta, and/or Yellow dyes to subtract from light reflected by paper, to produce all colors.
Examples of Subtractive color use:- Color printers Paints
Subtractive color wheel
13
Using Subtractive Colors on Film
Color absorbing pigments are layered on each other. As white light passes through each layer, different
wavelengths are absorbed. The resulting color is produced by subtracting
unwanted colors from white.
White light
Pigment layers
Reflecting layer (white paper)
M
YC
B R
G
K
W
Green Red Blue Black White
Cyan
Yellow Magenta Cyan
MagentaYellow
Black
14
Color Matching Experiment1. Observer views a split screen of
pure white (100% reflectance).
2. On one half, a test lamp casts a pure spectral color on the screen.
3. On the other, three lamps emitting variable amounts of red, green, and blue light are adjusted to match the color of the test light.
4. The amounts of red, green and blue light used to match the pure colors were recorded when an identical match was obtained.
5. The RGB tristimulus values for each distinct color was obtained this way.
Color matching experimental setup
Test Light
Tristimulus values
PrimaryMixture
15
380 480 580 680 780Wavelength (nm)
0
9
Re
lati
ve
po
we
r
The dashed line represents daylight reflected from sunflower, while the solid line represents the light emitted from the color monitor adjusted to match the color of the sunflower.
Metamerism Spectrally different lights
that simulate cones identically appear identical.
Such colors are called color metamers.
This phenomena is called metamerism.
Almost all the colors that we see on computer monitors are metamers.
16
The Mechanics of Metamerism Under trichromacy, any color
stimulus can be matched by a mixture of three primary stimuli.
Metamers are colors having the same tristimulus values R, G, and B; they will match color stimulus C and will appear to be the same color.
Wavelength (nm)780380 480 580 680
0
9
Re
lati
ve
po
we
r
The two metamers look the same because they have similar tristimulus values.
Wavelength (nm)780380 480 580 680
0
9
Re
lati
ve
po
we
r
Wavelength (nm)780380 480 580 680
0
9
Re
lati
ve
po
we
r
780
380
780
380
780
380
R S r d
G S g d
B S b d
17
Gamut A gamut is the range of
colors that a device can render, or detect.
The larger the gamut, the more colors can be rendered or detected.
A large gamut implies a large color space.
00
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
x
y
Human vision gamut
Monitor gamut
Photographic film gamut
18
Color Spaces A Color Space is a method by which colors are
specified, created, and visualized.
Colors are usually specified by using three attributes, or coordinates, which represent its position within a specific color space.
These coordinates do not tell us what the color looks like, only where it is located within a particular color space.
Color models are 3D coordinate systems, and a subspace within that system, where each color is represented by a single point.
19
Color Spaces Color Spaces are often geared towards specific
applications or hardware.
Several types:-HSI (Hue, Saturation, Intensity) basedRGB (Red, Green, Blue) basedCMY(K) (Cyan, Magenta, Yellow, Black) basedCIE basedLuminance - Chrominance based
CIE: International Commission on Illumination
20
RGB* One of the simplest color models.
Cartesian coordinates for each color; an axis is each assigned to the three primary colors red (R), green (G), and blue (B).
Corresponds to the principles of additive colors.
Other colors are represented as an additive mix of R, G, and B.
Ideal for use in computers.
*Red, Green, and Blue
Black(0,0,0)
Cyan(0,1,1)
Green(0,1,0)
Yellow(1,1,0)
Red(1,0,0)
Magenta(1,0,1)
Blue(0,0,1)
White(1,1,1)
RGB Color Space
21
RGB Image Data
Red Channel
Green Channel
Full Color Image
Blue Channel
22
CMY(K)* Main color model used in the
printing industry. Related to RGB.
Corresponds to the principle of subtractive colors, using the three secondary colors Cyan, Magenta, and Yellow.
Theoretically, a uniform mix of cyan, magenta, and yellow produces black (center of picture). In practice, the result is usually a dirty brown-gray tone. So black is often used as a fourth color.
*Cyan, Magenta, Yellow, (and blacK)
Magenta
YellowCyan
Blue Red
Green
Black
White
Producing other colors from subtractive colors.
23
CMY Image Data
Full Color Image Cyan Image (1-R)
Magenta Image (1-G) Yellow Image (1-B)
24
CMY – RBG Transformation
The following matrices will perform transformations between RGB and CMY color spaces.
Note that:- R = Red G = Green B = Blue C = Cyan M = Magenta Y = Yellow All values for R, G, B
and C, M, Y must firstbe normalized.
1
1
1
C R
M G
Y B
1
1
1
R C
G M
B Y
25
CMY – CMYK Transformations The following matrices will perform transformations between
CMY and CMYK color spaces.
Note that:- C = Cyan M = Magenta Y = Yellow K = blacK All values for R, G, B
and C, M, Y, K must firstbe normalized.
min( , , )
( ) (1 )
( ) (1 )
( ) (1 )
K C M Y
C C K K
M M K K
Y Y K K
min(1, (1 ) )
min(1, (1 ) )
min(1, (1 ) )
C C K K
M M K K
Y Y K K
26
RGB – CMYK Transformations The following matrices perform transformations between RGB
and CMYK color spaces.
Note that:- R = Red G = Green B = Blue C = Cyan M = Magenta Y = Yellow All values for R, G, B
and C, M, Y must firstbe normalized.
1 min(1, (1 ) )
1 min(1, (1 ) )
1 min(1, (1 ) )
R C K K
G M K K
B Y K K
min(1 ,1 ,1 )
(1 ) (1 )
(1 ) (1 )
(1 ) (1 )
K R G B
C R K K
M G K K
Y B K K
27
RGB – Gray Scale Transformations The luminancy component, Y, of each color is summed to
create the gray scale value.
ITU-R Rec. 601-1* Gray scale:
Y = 0.299R + 0.587G + 0.114B
ITU-R Rec. 709 D65 Gray scale
Y = 0.2126R + 0.7152G + 0.0722B
ITU standard D65 Gray scale (Very close to Rec 709!)
Y = 0.222R + 0.707G + 0.071B*601-1: Based on an old television (NTSC: National Television System Committee) standard 709 : Based on High Definition TV colorimetry (Contemporary CRT phosphors) ITU : International Telecommunication Union
28
RGB and CMYK Deficiencies RGB and CMY color models
limited to brightest available primaries (R, G, and B) and secondaries (CYM).
Not intuitive. We think of light in terms of color, intensity of color, and brightness. Colors changed by changing
R, G, B ratios. Brightness changed by
changing R, G, and B, while maintaining their ratios.
Intensity changed by projecting RGB vector toward largest valued primary color (R, G, or B).
00
0.2 0.4 0.6 0.8
0.2
0.4
0.6
0.8
x
y
Monitor RGB gamut
Photographic film gamut
6 colorCMY printer
gamut
Hexachrome: Cyan, Magenta, Yellow, Black, Orange, Green
29
HSI / HSL / HSV* Very similar to the way human visions see color.
Works well for natural illumination, where hue changes with brightness.
Used in machine color vision to identify the color of different objects.
Image processing applications like histogram operations, intensity transformations, and convolutions operate on only an image's intensity and are performed much easier on an image in the HSI color space.
*H=Hue, S = Saturation, I (Intensity) = B (Brightness), L = Lightness, V = Value
30
HSI Color Space Hue
What we describe as the color of the object.
Hues based on RGB color space. The hue of a color is defined by
its counterclockwise angle from Red (0°); e.g. Green = 120 °, Blue = 240 °.
RGB Color Space
RGB cube viewed fromgray-scale axis
RGB cube viewed from gray-scale axis, and
rotated 30°HSI Color Wheel
Red 0º
Green 120º
Blue 240º
Saturation Degree to which hue differs from
neutral gray. 100% = Fully saturated, high
contrast between other colors. 0% = Shade of gray, low contrast. Measured radially from intensity
axis.
0% Saturation 100%
31
HSI Color Space Intensity
Brightness of each Hue, defined by its height along the vertical axis.
Max saturation at 50% Intensity.
As Intensity increases or decreases from 50%, Saturation decreases.
Mimics the eye response in nature; As things become brighter they look more pastel until they become washed out.
Pure white at 100% Intensity. Hue and Saturation undefined.
Pure black at 0% Intensity. Hue and Saturation undefined.
Hue
Saturation 0%100%
Intensity 100%
0%
32
HSI Image Data
Hue Channel
Saturation Channel Intensity Channel
Full Image
33
HSI - RGB For a given RGB color of (R, G, B), the same color in the HSI Model
is C(x,y) = (H, S, I), where
1
2
( ) ( )2cos in [0,180 )
( ) ( )( )
R G R B
R G R B G B
where
min , ,1 3
R G BS
R G B
Saturation
for , , [0,1]3
R G BI R G B
Intensity
, if
360 , if
B GH
B G
Hue
34
RGB to HSI Example Consider the RGB color defined by (215, 97,198)
R = 215, G = 97, B = 198
1
2
(215 97) (215 198) 2cos 51.68
(215 97) (215 198)(97 198)
min 215,97,198 971 3 1 3 0.843
215 97 198 215 97 198S
215 255 97 255 198 2550.67
3I
, if 360 51.68 308.64
360 , if
B GH
B G
Green(0,255,0)
Red(255,0,0)
Blue(0,0,255)
Blue240º
Green120º
Red0º
Therefore, HSI coordinates = (308.64°, 0.843, 0.67)
35
HSI to RBG Dependent on which sector H lies in.
Blue240º
Green120º
Red0º
For 120º H 240 º 120
1(1 )
3
1 cos( )1
3 cos(60 )
1 ( )
H H
r S
S Hg
H
b r g
For 240º H 360 º
240
11
3
1 cos1
3 cos(60 )
1 ( )
H H
g S
S Hb
H
r g b
For 0º H 120 º
11
3
1 cos1
3 cos(60 )
1 ( )
b S
S Hr
H
g r b
36
HSV Color Space Hue and Saturation similar to that
of HSI color model.
V: Value; defined as the height along the central vertical axis.
Like Intensity in HSI, color intensity increases as Value increases.
HSV: Hue, Saturation, and Value
Hue
Saturation 0%100%
Valu
e
100%
0%
37
HSV Color Space
Smax at V100
Value
Smax at I50
Intensity
Hue and Saturation similar to that of HSI color model.
V: Value; defined as the height along the central vertical axis.
Like Intensity in HSI, color intensity increases as Value increases.
As Value increases, hues become more saturated. Hues do not progress through the pastels to white, just as fluorescent images never change colors even though its intensity may increase. HSV is good for working with fluorescent colors.
HSV: Hue, Saturation, and Value
38
Intensity Operations in HSI To change the individual color
of any region in the RGB image, change the value of the corresponding region in the Hue image.
Then convert the new H image with the original S and I images to get the transformed RGB image.
Saturation and Intensity components can likewise be manipulated.
Hue
Saturation Intensity
Original Image
39
Disadvantages of HSI Color ModelThere are many disadvantages to the HS color model. For example:
Cannot perform addition of colors expressed in polar coordinates. Transformations are very difficult because Hue is expressed as an angle.
For color machine vision, the hues of low-saturation may be difficult to determine accurately. Systems which must be able to differentiate all colors, saturated and unsaturated, will have significant problems using the HSI representation.
When saturation is zero, hue is undefined.
Transforming between HSI and RGB is complicated.
40
1931 CIE* Standard Observer(r, g, b)
The following color matching functions were obtained.
There were problems with the r, g, b color matching functions.
Negative values meant that the color had to be added to the test light before the two halves could be balanced.
380 480 580 680 780Wavelength (nm)
Tris
timu
lus
valu
es
0.3
0.2
0.1
0.0
-0.1
0.4
r
g
b
Color-matching functions for 1931 Standard Observer, the average of 17 color-normal observers having matched each wavelength of the equal energy spectrum with primaries of 435.8nm, 546.1 nm, and 700 nm, on a bipartite 2° field, surrounded by darkness.
*Commission Internationale de L’Éclairage
41
1931 CIE Standard Observer(x, y, z)
CIE adopted another set of primary stimuli, designated as X, Y, and Z.
Special properties of X, Y, Z:-
Imaginary (non-physical) primary.
All luminance information is contributed by Y.
Linearly related to R, G, B. Non-negative values for all
tristimulus values.
380 480 580 680 780Wavelength (nm)
2.0
1.5
1.0
0.5
0.0T
ristim
ulu
s va
lue
s
z
xy
1931 standard observer (2° observer).
42
CIE 1931 xy Chromaticity Diagram 2D projection of 3D CIE XYZ
color space onto X+Y+Z=1 plane.
x and y calculated as follows:-
The chromaticity of a color is determined by (x,y).
Xx
X Y Z
Y
yX Y Z
1Z
z x yX Y Z
43
CIE 1931 xy Chromaticity Diagram For color C, where
C 0.5 X + 0.4 Y + 0.1 Z
Color C is represented as (0.5, 0.4) on the Chromaticity diagram.
0.50.5
0.5 0.4 0.10.4
0.40.5 0.4 0.1
0.11 0.5 0.4 0.1
0.5 0.4 0.1
x
y
z
(0.5, 0.4)
44
CIE 1931 xyY Chromaticity Diagram
Each point on xy corresponds to many points in the original 3D CIE XYZ space.
Color is usually described by xyY coordinates, where Y is the luminance, or lightness component of color.
Y starts at 0 from the white spot (D65) on the xy plane, and extends perpendicularly to 100.
As the Y increases, the colors become lighter, and the range of colors, or gamut, decreases.
45
CIE XYZD65 to sRGB* The following transformations allow transformations between
CIE XYZD65 and the sRGB color models.
65
0.412453 0.357580 0.180423
0.212671 0.715160 0.072169
0.019334 0.119193 0.950227D sRGB
X R
Y G
Z B
65
3.240479 1.537150 0.498535
0.969256 1.875992 0.041556
0.055648 0.204043 1.057311sRGB D
R X
G Y
B Z
*sRGB = Standard RGB, the standard for Internet use.
46
CIE XYZRec. 609-1 - RGB The following are the transformations needed to convert
between CIE XYZRec.609-1 and RGB.
601
0.609 0.174 0.200
0.299 0.578 0.114
0.000 0.066 1.116
X R
Y G
Z B
601
1.910 0.532 0.288
0.985 1.999 0.028
0.058 0.118 0.898
R X
G Y
B Z
47
CIE XYZ - RGBRec. 709
Use the following matrices to transform between CIE XYZ and Rec. 709 RGB (with its D65 white).
709
709
709
3.240479 1.537150 0.498535
0.969256 1.875992 0.041556
0.055648 0.0204043 1.057311
R X
G Y
B Z
709
709
709
0.412453 0.357580 0.180423
0.212671 0.715160 0.072169
0.019334 0.119193 0.950227
X R
Y G
Z B
48
XYZD65 - XYZD50 Transformations If the illuminant is changed from D50 to D65, the observed
color will also change.
The following matrices enable transformations between XYZD65 and XYZD50.
50 65
1.0479 0.0229 0.0502
0.0296 0.9904 0.0171
0.0092 0.0151 0.7519D D
X X
Y Y
Z Z
65 50
0.9555 0.0231 0.0633
0.0283 1.0100 0.0211
0.0123 0.0206 1.3303D D
X X
Y Y
Z Z
49
Inadequacies in the 1931 xy Chromaticity Diagram
Each line in the diagram represents a color difference of equal proportion.
The lines vary in length, sometimes greatly, depending on what part of the diagram they're in.
The differences in line length indicates the amount of distortion between parts of the diagram.
50
CIE 1960 u,v Chromaticity Diagram
To correct for the deformities in the 1931 xy diagram, a number of uniform chromaticity scale (UCS) diagrams were proposed.
The following formula transforms the XYZ values or x,y coordinates to a set of u,v values, which present a visually more accurate 2D model.
4 4
15 3 2 12 3
6 6
15 3 2 12 3
X xu
X Y Z x y
X yv
X Y Z x y
51
CIE 1976 u', v' Chromaticity Diagram
But the 1960 uv diagram was still unsatisfactory.
In 1975, CIE modified the u,v diagram and by supplying new (u',v') values. This was done by multiplying the v values by 1.5. Thus in the new diagram u' = u and v' = 1.5v.
The following formulas allow transformation between u’v’ and xy coordinates.
'
'
4 4
15 3 2 12 3
9 9
15 3 2 12 3
X xu
X Y Z x y
X yv
X Y Z x y
'
' '
'
' '
27
18 48 36
12
18 48 36
ux
u v
vy
u v
52
CIE 1976 u', v' Chromaticity Diagram
Each line in the diagram represents a color difference of equal proportion.
While the representation is not perfect (it can never be), the u',v' diagram offers a much better visual uniformity than the xy diagram.
53
CIE L*u*v* Color Space/ CIELUV Replaces uniform lightness
scale Y with L*, an visually linear scale.
Equations are as follows:-
where un’ and vn’ refer the the reference white light or light source.
* 13 *( ' ')nu L u u * 13 *( ' ')nv L v v
1
3* 116 16 0.008856
903.3 0.008856
n n
n n
Y YL if
Y Y
Y Yif
Y Y
54
CIE L*a*b* Color Space / CIELAB Second of two systems adopted by CIE in
1976 as models that better showed uniform color spacing in their values.
Based on the earlier (1942) color opposition system by Richard Hunter called L, a, b.
Very important for desktop color.
Basic color model in Adobe PostScript (level 2 and level 3)
Used for color management as the device independent model of the ICC* device profiles.
CIE L*a*b* color axes
*International Color Consortium
55
CIE L*a*b* (cont’d) Central vertical axis : Lightness (L*),
runs from 0 (black) to 100 (white).
a-a' axis: +a values indicate amounts of red, -a values indicate amounts of green.
b-b' axis, +b indicates amounts of yellow; -b values indicates amounts of blue. For both axes, zero is neutral gray.
Only values for two color axes (a*, b*) and the lightness or grayscale axis (L*) are required to specify a color.
CIELAB Color difference, E*ab, is between two points is given by:
+a
-a
-b
+b
100
0
L*
CIE L*a*b* color axes
(L1*, a1*, b1*)
(L2*, a2*, b2*)
2 2 2* ( *) ( *) ( *)abE L a b
56
CIELAB Image Data
Full Color Image L data
L-a channel L-b channel
57
XYZ to CIELAB Given Xn, Yn, and Zn, which are the tristimulus values for the
reference white, for a point X, Y, Z:-
* 500n n
X Ya f f
X Y
* 200n n
Y Zb f f
Y Z
1
3 if 0.00886 16
7.787 if 0.00886116
where f
1
3
If 0.008856 then * 116 16 else * 903.3n n n
Y Y YL L
Y Y Y
58
CIELAB to XYZ Reverse transformation to XYZ, given L*a*b* values.
For
3* 16
116n
LY Y
3* 16 *
116 200n
L bZ Z
3* 16 *
116 500n
L aX X
0.008856n
Y
Y
59
CIE L*C*h* (LCh) Often referred to simply as LCh. Same system is the same as the
CIELab color space, except that it describes the location of a color in space by use of polar coordinates rather than rectangular coordinates.
L* is a measure of the lightness of a sample, ranging from 0 (black) to 100 (white).
C* is a measure of chroma (saturation), and represents distance from the neutral axis.
h is a measure of hue and is represented as an angle ranging from 0° to 360.
H (Hue)
C* (Chroma) 0%100%
L* (
Lightn
ess
)
100%
0%
60
Y’U’V’1 (EBU2) Color Space
Standard color space used for analogue television transmissions in European TVs (PAL3 and SECAM4).
Y is the luminance (or luma) or black and white component
U and V represent the color differences: U = B - Y; V = R - Y
U represents the Blue - Yellow axis; V, the Red - Green axis.
Gamma for PAL is assumed to be 2.8
1 Y = Luminance, U and V are chrominance components2 European Broadcasting Union3 Phase Alternation Line video standard for Europe; U = 0.492(B-Y); V = 0.877(R-Y)4 Sequential Couleur avec Mémoire, video standard for France, the Middle East and most of Eastern Europe
Red: xR = 0.630 yR = 0.340
Green: xG = 0.310 yG = 0.595
Blue: xB = 0.155 yB = 0.070
White xW= 0.312713 yW = 0.329016
61
Y'UV Channels
Full Color Image Y
U (Blue - Yellow) V (Red - Green)
62
Nonlinear Y’U’V’Transformations
The following matrices allow transformations of nonlinear signals between Y’U’V’ and R’G’B.
' 0.299 0.587 0.114 '
' 0.147 0.289 0.436 '
' 0.615 0.515 0.100 '
Y R
U G
V B
' 1.000 0.000 1.140 '
' 1.000 0.396 0.581 '
' 1.000 2.029 0.000 '
R Y
G U
B V
63
Linear Y’U’V’ Transformations The following matrices allow transformations of linear signals
between YUV RGB and XYZ.
1.000 0.000 0.140
1.000 0.396 0.581
1.000 2.029 0.000
R Y
G U
B V
0.431 0.342 0.178
0.222 0.707 0.071
0.020 0.130 0.939
X R
Y G
Z B
64
Y’I’Q’1 Color Space
Used in NTSC2 color broadcasting in USA; compatible with black and white television, which only uses Y.
U and V defines colors clearly, but do not align with desired human perceptual sensitivities.
Y [0..1] is the luminance (or luma) component.
I [-0.523 .. 0.523] represents the Orange-Blue axis.
Q [-0.596 .. 0.596] represents the Purple-Green axis.
1Y’I’Q’ = Luminance, In-phase, and Quadrature phase.2National Television Standards Committee video standard for North America
Red: xR = 0.67yR = 0.33
Green: xG = 0.21 yG = 0.71
Blue: xB = 0.14yB = 0.08
White xW= 0.310063 yW = 0.316158
65
YIQ Channels
Full Color Image Y Channel
Q (Purple - Green)I (Orange - Blue)
66
Y’I’Q’ – R’G’B’ Use the following matrices to transform linear signals between
Y’I’Q’ and gamma-corrected RGB values.
' 1.000 0.956 0.621 '
' 1.000 0.272 0.647 '
' 1.000 1.105 1.702 '
R Y
G I
B Q
' 0.299 0.587 0.114 '
' 0.596 0.275 0.321 '
' 0.212 0.523 0.311 '
Y R
I G
Q B
67
YIQ - YUV YIQ - YUV transformation is simply a color rotation of 33º. The following matrices can be used to transform between
NTSC based YIQ and PAL based YUV.
1.000 0.000 0.000
0.000 0.2676 0.7361
0.000 0.3869 0.4596
YIQ YUVY Y
I U
Q V
1.000 0.000 0.000
0.000 1.270 1.8050
0.000 0.9489 0.6561
YUV YIQY Y
U I
V Q
68
Y’CbCr* Color Space
Y’ is luminance, Cb is the chromaticity component for blue, and Cr is the chromaticity component for red.
Very closely related to the YUV, it is a scaled and shifted YUV.
Cb = (B - Y) / 1.772 + 0.5 Cr = (R - Y) / 1.402 + 0.5
Chrominance values Cb and Cr are [ 0..1 ].
Deals only with digital representation of R’G’B’ signals in Y’CbCr
form.
Color format for JPEG1 and MPEG2.
Independent of scanning standard and system primaries, therefore:- No chromaticity coordinates. No CIE XYZ matrices. No assumptions about white point. No assumptions about CRT gamma.
1JPEG = Joint Photography Experts Group2MPEG = Motion Pictures Experts Group
69
Y'CbCr - RGB[0..+1]
Use the following matrices to convert between YCbCr and RGB ranging from [0 .. +1]
'601 16 65.481 128.553 24.996 '
128 37.797 74.203 112.000 '
128 112.000 93.786 18.214 'B
R
Y R
C G
C B
'601' 0.00456621 0 0.00625893 16
' 0.00456621 0.00153632 0.00318811 128
' 0.00456621 0.00791071 0 128B
R
R Y
G C
B C
70
ITU-R.601 YCbCr - R’G’B’219 ITU-R.601 defines 16 =< Y >= 235, and 16 =< Cb and Cr >= 240,
with 128 corresponding to 0. These BT.601 equations are used by many video ICs to convert
between digital R’G’B’ and BT.601 YCbCr data.
0.301 0.586 0.113 ' 0
0.172 0.340 0.512 ' 128
0.512 0.430 0.082 ' 128b
r
Y R
C G
C B
ITU-R.601 = International Telecommunication Union – Radio communications Recommendation 601RGB219 = A restricted color space used to match YUV standard transmission values
' 1.000 0.000 1.371 16
' 1.000 0.336 0.698 128
' 1.000 1.732 0.000 128b
r
R Y
G C
B C
The R’G’B’ values produced have a nominal range of 16 - 235.
71
ITU-R.601 YCbCr - R’G’B’0-255 If 24 bit R’G’B’ data needs to have a range of 0-255, the following
equation should be used. The R’, G’, and B’ values must be saturated at the 0 and 255
values.
0.257 0.504 0.098 ' 16
0.148 0.291 0.439 ' 128
0.439 0.368 0.071 ' 128b
r
Y R
C G
C B
' 1.164 0.000 1.596 16
' 1.164 0.392 0.813 128
' 1.164 2.017 0.000 128b
r
R Y
G C
B C
72
YCbCr 4:4:4 Full resolution YCbCr 4:4:4 is in
uncompressed data format. Each pixel has all Y, Cb and
Cr values.
Chrominance data can be subsampled without significant degradation in image quality.
YCbCr 4:4:4
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
73
YCbCr 4:4:4
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCbCr 4:2:2 Obtained by a 2:1 horizontal
subsampling of YCbCr 4:4:4 values.
Often used digital cameras, and many video ICs.
Restore original colors by interpolating missing Cb and Cr values from the values present.
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCbCr 4:2:2
74
YCbCr 4:2:0 YCbCr 4:2:0 obtained by a
2:1 horizontal and vertical subsampling of YCbCr 4:4:4 values.
YCbCr (or, often called “YUV”) values are often subsampled to 4:2:0 before JPEG compression.
Restore original colors by interpolating missing Cb and Cr values from available values.
YCbCr 4:4:4
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
Y
Y Y
YCb Cr
Y
Y Y
YCb Cr
Y
Y Y
YCb Cr
Y
Y Y
YCbCr 4:2:0
75
YCbCr 4:4:4
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCbCr 4:1:1 YCbCr 4:1:1 obtained by a
4:1 horizontal subsampling of YCbCr 4:4:4 values.
VHS* quality color.
Y YCb Cr
Y YCb Cr
Y YCb Cr
Y YCb Cr
Y Y
Y Y
Y Y
Y Y
YCbCr 4:1:1
VHS: Video Home System
76
YCbCr 4:2:2 - RGB1. Convert YCbCr 4:2:2 to YCbCr 4:4:4, through
interpolation.
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCb Cr
Y
YCbCr 4:2:2
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCb Cr
YCbCr 4:4:4
Interpolation of Cb and Cr
values
77
YCbCr 4:2:2 - RGB
' 0.299 0.587 0.114 '
0.169 0.331 0.500 '
0.500 0.419 0.081 'b
r
Y R
C G
C B
' 1.000 0.000 1.403 '
' 1.000 0.344 0.714
' 1.000 1.773 0.000b
r
R Y
G C
B C
1. Convert YCbCr 4:2:2 to YCbCr 4:4:4, through interpolation.
2. Convert YCbCr 4:4:4 to nonlinear R’G’B’.
78
YCbCr 4:2:2 - RGB
'255 255
4.5
'255 255
4.5
'255 255
4.5
RR
GG
BB
1. Convert YCbCr 4:2:2 to YCbCr 4:4:4, through interpolation.
2. Convert YCbCr 4:4:4 to nonlinear R’G’B’.
3. If necessary, convert nonlinear R’G’B’ to linear RGB by removing gamma information.
For (R’, G’, B’) < 21 For (R’, G’, B’) 212.2
2.2
2.2
' 0.0992552551.099
' 0.0992552551.099
' 0.0992552551.099
RR
RG
RB
79
SMPTE*-C RGB Color Space
Current color standard for broadcasting in America, replacing older NTSC standard.
Reason for standard change: original set of (YIQ) primaries being slowly changed to YUV primaries.
CRT gamma assumed to be 2.2 with NTSC, 2.8 with PAL.
*Society of Motion Picture and Television Engineers
Red: xR = 0.630 yR = 0.340
Green: xG = 0.310 yG = 0.595
Blue: xB = 0.155 yB = 0.070
White xW= 0.312713 yW = 0.329016
80
Linear SMPTE-C RGB Transformations
The following matrices allow transformations of linear signals between SMPTE-C RGB and XYZ.
0.3935 0.3653 0.1916
0.2124 0.7011 0.0866
0.0187 0.1119 0.9852SMPTE C
X R
Y G
Z B
3.5058 1.7397 0.5440
1.0690 1.9778 0.0352
0.0563 0.1970 1.0501SMPTE C
R X
G Y
B Z
81
Nonlinear SMPTE-C RGB Transformation
The transformation matrices for non-linear signals are the same as that of the older YIQ (NTSC) standard.
' 1.000 0.956 0.621 '
' 1.000 0.272 0.647 '
' 1.000 1.105 1.702 '
R Y
G I
B Q
' 0.299 0.587 0.114 '
' 0.596 0.275 0.321 '
' 0.212 0.523 0.311 '
Y R
I G
Q B
82
ITU.BT-709 in Y'CbCr
Recent standard, defined only as an interim standard for HDTV studio production.
Defined by the CCIR (now the ITU-R) in 1988, but is not yet recommended for use in broadcasting.
The primaries are the R and B from the EBU, and a G which is midway between SMPTE-C and EBU.
CRT gamma is assumed to be 2.2.
Red: xR = 0.64yR = 0.33
Green: xG = 0.30 yG = 0.60
Blue: xB = 0.15yB = 0.06
White (D65): xW= 0.312713 yW = 0.329016
ITU: International Telecommunication UnionCCIR: Comite Consultatif International des Radiocommunications
83
Linear XYZ Rec.709 – RGBD65
The following matrices allow transformation between linear signals of Rec.709 XYZ values and RGBD65.
709 65
709 65
709 65
0.412 0.358 0.180
0.213 0.715 0.072
0.019 0.119 0.950
D
D
D
X R
Y G
Z B
65 709
65 709
65 709
3.241 1.537 0.499
0.969 1.876 0.042
0.056 0.204 1.057
D
D
D
R X
G Y
B Z
84
RGBEBU – RGB709 The following matrices allow transformation between linear Rec.
709 RGB signals and EBU* RGB signals.
709
709
709
0.9578 0.0422 0.0000
0.0000 1.0000 0.0000
0.0000 0.0118 0.9882
EBU
EBU
EBU
R R
G G
B B
709
709
709
1.0440 0.0440 0.0000
0.0000 1.0000 0.0000
0.0000 0.0119 1.0119
EBU
EBU
EBU
R R
G G
B B
European Broadcasting Union
85
Nonlinear Y’CbCr 709– R’G’B’ The following matrices allow transformation between nonlinear Rec.709
Y’CbCr signals and R’G’B’. Scaling optimized for digital video.
' 1.0000 0.0000 1.5701 '
' 1.0000 0.1870 0.4664
' 1.000 1.8556 0.0000b
r
R Y
G C
B C
' 0.2215 0.7154 0.0721 '
0.1145 0.3855 0.5000 '
0.5016 0.4556 0.0459 'b
r
Y R
C G
C B
86
SMPTE-240M Y’PbPr (HDTV*)
This one of the developments of NTSC component coding, in which the B primary and white point were changed. With this space color, all three components Y’, Pb, and Pr are linked to luminance.
Standard for coding High Definition TV broadcasts in the USA.
The CRT gamma law is assumed to be 2.2.
*High Definition TeleVision
Red: xR = 0.67yR = 0.33
Green: xG = 0.21 yG = 0.71
Blue: xB = 0.15yB = 0.06
White xW= 0.312713 yW = 0.329016
87
RGB240M - RGB709
The following transforms between SMPTE* 240M (SMPTE RP 145 or Y'PbPr) RGB to Rec. 709 RGB.
*Society of Motion Picture and Television Engineers 240M = Recommended Standard for USA’s HDTV
240 709
1.065364 0.055391 0.009974
0.019635 1.036361 0.016725
0.001632 0.004414 0.993954M
R R
G G
B B
709 240
0.939555 0.050173 0.010272
0.017775 0.965795 0.016430
0.001622 0.004371 1.005993M
R R
G G
B B
88
RGB240M - RGBEBU
The following transforms from SMPTE 240M (SMPTE RP 145, or YPbPr) RGB into to Rec. 709 RGB.
240
240
240
1.3481 0.3481 0.0000
0.0257 1.0257 0.0000
0.0254 0.0568 1.0822
EBU
EBU
EBU
R R
G G
B B
240
240
240
0.7466 0.2534 0.0000
0.0187 0.9813 0.0000
0.0185 0.0575 0.9240
EBU
EBU
EBU
R R
G G
B B
89
Linear SMPTE-240M XYZ - RGB The following matrices allow linear transformations
between SMPTE-240M XYZ and RGB.
0.567 0.190 0.193
0.279 0.643 0.077
0.000 0.073 1.016
X R
Y G
Z B
2.041 0.564 0.345
0.893 1.816 0.032
0.064 0.130 0.982
R X
G Y
B Z
90
Nonlinear SMPTE-240M Y’PbPr Transformations
The following matrices allow nonlinear transformations between Y’PbPr and R’G’B’.
Scaling suited for component analogue video.
' 0.2122 0.7013 0.0865 '
0.1162 0.3838 0.5000 '
0.5000 0.4451 0.0549 '
Y R
Pb G
Pr B
' 1.000 0.000 1.5756 '
' 1.000 0.2253 0.5000
' 1.000 1.8270 0.0000
R Y
G Pb
B Pr
91
Xerox Corporation Y’E’S’1
Standard proposed by Xerox Corporation.
YES has three components:
Y, or luminancy,
E, or chrominancy of the red-green axis, and
S, chrominancy of the yellow-blue axis.
The following examples assume a CRT gamma of 2.2.
1YES = Luminance, E = red-green chromaticity, S = blue-yellow chromaticity
92
Y’E’S’ to XYZD50 Transformation If you start with non-linear Y’E’S’ values, apply a gamma correction
to convert to linear YES values first:-
Next, apply the following transformation to the linear YES.
2.2
2.2
2.2
'
'
'
YY
E E
SS
50
0.964 0.528 0.157
1.000 0.000 0.000
0.825 0.269 1.289D
X Y
Y E
Z S
93
XYZD50 to YES Transformation First, apply the following transformation matrix to obtain linear
YES from XYZD50.
For non-linear Y’E’S’ values, apply a gamma correction.
1
2.2
1
2.2
1
2.2
'
'
'
YY
E E
SS
50
0.000 1.000 0.000
1.783 1.899 0.218
0.374 0.245 0.734D
Y X
E Y
S Z
94
YES to XYZD65 Transformation As before, if you start with non-linear Y’E’S’ values, apply a
gamma correction to convert to linear YES values first:-
Next, apply the following transformation to the linear YES.
2.2
2.2
2.2
'
'
'
YY
E E
SS
65
0.782 0.466 0.138
1.000 0.000 0.000
0.671 0.237 1.133D
X Y
Y E
Z S
95
XYZD65 to YES Transformation First, apply the following transformation matrix to obtain linear
YES from XYZD50.
If required, apply a gamma correction to obtain Y’E’S’.
1
2.2
1
2.2
1
2.2
'
'
'
YY
E E
SS
65
0.000 1.000 0.000
2.019 1.743 0.246
0.423 0.227 0.831D
Y X
E Y
S Z
96
Kodak Photo CD YCC (YC1C2) Color Space
Based on Rec. 709 and 601-1, the YCC color space has color gamut defined by the Rec. 709 primaries and a luminance - chrominance representation of color like ITU 601-1's YCbCr.
YCC provides a color gamut that is greater than that which can currently be displayed, and is therefore suitable not only for both additive and subtractive (RGB and CMY(K)) reproduction.
Extended color gamut obtainable by the PhotoCD system is achieved by allowing both positive and negative values for each primary, allowing YCC to store more colors than current display devices, such as CRT monitors and dye-sublimation printers, can produce.
97
Transformations to Encode Kodak YC1C2 Data
First, apply a gamma correction:
Next, transform the R’G’B’ data into YC1C2 data.
Scaling is optimized for films.
0.45
0.45
0.45
' 1.099 0.099
' 1.099 0.099
' 1.099 0.099
R R
G G
B B
' 4.5
' 4.5
' 4.5
R R
G G
B B
1
2
0.299 0.587 0.114 '
1 0.299 0.587 0.886 '
2 0.701 0.587 0.114 '
Luma Y R
Chroma C G
Chroma C B
For R709, G709, B709 0.018 For R709, G709, B709 0.018
98
Transformations to Encode YC1C2 Data (cont’d)
Finally, store the floating point values as 8-bit integers.
The unbalanced scale difference between Chroma1 and Chroma2 is designed, according to Kodak, to follow the typical distribution of colors in real scenes.
1
2
8 _ _ 255 1.402
8 _ _ 1 111.40 156
8 _ _ 2 135.64 136
bit Luma Y
bit Chroma C
bit Chroma C
99
Transforming YC1C2 Data to 24-bit RGB
Kodak YCC can store more information than current display devices can cope with (it allows negative RGB values), so the transforms from YCC to RGB are not simply the inverse of RGB to YCC, they depend on the target display system.
First, recover normal Luma (Y) and Chroma (C1 and C2) data.
Second, if the display primaries match Rec. 709 primaries in their chromaticity, then
2
1 2
1
'
' 0.194 0.509
'
R Y C
G Y C C
B Y C
1
2
8 _ _ 1.3584
1 2.2179 (8 _ _ 1 - 156)
2 1.8215 (8 _ _ 2 - 137)
Luma Y bit Luma
Chroma C bit Chroma
Chroma C bit Chroma
100
YC1C2 – RGB Signal Voltages
First, recover normal Luma (Y) and Chroma (C1 and C2).
Then, calculate the RGB display voltages as follows;
'
' 1
' 2
1.000 0.000 1.0001
1.000 0.194 0.509353.2
1.000 1.000 0.000
R
G
B
V Y
V C
V C
1
2
8 _ _ 1.3584
1 2.2179 (8 _ _ 1 - 156)
2 1.8215 (8 _ _ 2 - 137)
Luma Y bit Luma
Chroma C bit Chroma
Chroma C bit Chroma
101
PhotoYCC - YCbCr
1
2
0.713
0.775 56.855
0.746 41.521
YCC YCbCr
b
r
Y Y
C C
C C
Transform YCbCr data into PhotoYCC color space as follows:-
The image produced may not match an image that was one encoded directly in PhotoYCC color space.
1
2
1.402
1.291 73.400
1.340 55.638
YCbCr YCC
b
r
Y Y
C C
C C
Transform PhotoYCC color space into YCbCr values as follows:-
As the PhotoYCC color space is larger than the YCbCr color space, the produced image may be poorer than the original.
102
sRGB specs
sRGB Viewing Environment Summary
Condition sRGB
Display Luminance level 80 cd/m2
Display White Point x = 0.3127, y = 0.3290 (D65)
Display model offset (R, G and B) 0.0
Display input/output characteristic 2.2
Reference ambient illuminance level 64 lux
Reference Ambient White Point x = 0.3457, y = 0.3585 (D50)
Reference Veiling Glare 0.2 cd m-2
CIE chromaticities for ITU-R BT.709 reference primaries and CIE standard illuminant
Red Green Blue D65 White Point x 0.6400 0.3000 0.1500 0.3127 y 0.3300 0.6000 0.0600 0.3290 z 0.0300 0.1000 0.7900 0.3583
103
Glossary of Color Models
Color Space
Primaries White pt Gamma Rx Ry Gx Gy Bx By Wx Wy Std name
Apple RGB Trinitron D65 1.8 0.63 0.34 0.28 0.6 0.16 0.07 0.31271 0.32902 Trinitron
SMPTE-CSMPTE-C
(CCIR 601-1)D65 2.2 0.63 0.34 0.31 0.6 0.16 0.07 0.31271 0.32902 ?
sRGBHDTV
(CCIR 709)D65 2.2 0.64 0.33 0.3 0.6 0.15 0.06 0.31271 0.32902 CCIR 709
Pal/Secam EBU/ITU D65 2.2 0.64 0.33 0.29 0.6 0.15 0.06 0.31271 0.32902 CIE_XYZitu
Color Match RGB
P22-EBU D50 1.8 0.63 0.34 0.3 0.61 0.16 0.08 0.3457 0.3585 P22-EBU
Adobe RGBAdobe RGB
(1998)D65 2.2 0.64 0.33 0.21 0.71 0.15 0.06 0.31271 0.32902
Adobe RGB (1998)
NTSC (1953) NTSC (1953) Std Illmnt C 2.2 0.67 0.33 0.21 0.71 0.14 0.08 0.31006 0.31616 CCIR 601-1
CIE RGB CIE RGB Std Illmnt E 2.2 0.74 0.27 0.27 0.72 0.17 0.01 0.3333 0.3333 CIE RGB
CCIR: Comite Consultatif International des Radiocommunications
brightness - the human sensation by which an area exhibits more or less light.lightness - the sensation of an area's brightness relative to a reference white in the scene. luma - Luminance component corrected by a gamma function and often noted Y'.chroma - the colorfulness of an area relative to the brightness of a reference white.saturation - the colorfulness of an area relative to its brightness.
104
Glossary of Illuminants and Their Reference Whites
Illuminant wx wy
A 0.488 0.407
B 0.348 0.352
C 0.310 0.316
D5500 0.332 0.348
D6500 0.313 0.329
D7500 0.299 0.315
E 0.333 0.333
105
2D Color Spaces
RGB Color Space
HLS Color Space
SMPTE Color Space
NTSC Color Space
ITU Color Space
Rec.709 Color SpaceHSV Color Space
106
References BARCO Introduction to Color Theory, Monitor Calibration and
Color Management, http://www.barco.com/display_systems/support/colorthe/colorthe.htm
R. S. Berns, Principles of Color Technology (3rd Ed)., 2000
S. M. Boker, The Representation of Color Metrics and Mappings in Perceptual Color Space, http://kiptron.psyc.virginia.edu/steve_boker/ColorVision2/ColorVision2.html
D. Bourgin, Color spaces FAQ, http://www.inforamp.net/~poynton/notes/Timo/colorspace-faq, 1996,
R. Buckley, Xerox Corp., G. Bretta, Hewlett-Packard Laboratories, Color Imaging on the Internet, http://www.inventoland.net/imaging/cii/nip01.pdf, 2001
Color Representation, http://203.162.7.85/unescocourse/computervision/comp_frm.htm
107
References (cont’d) A. Ford and A. Roberts, Color Space Conversions,
www.inforamp.net/~poynton/PDFs/coloureq.pdf, 1998
Gonzales, Woods, Digital Image Processing, 2000
A. Kankaanpaa, Color Formats, www.physics.utu.fi/ett/kurssi/sfys3066/arto_tiivis.pdf, 2000.
M. Nielsen and M. Stokes, Hewlett-Packard Company, The Creation of the sRGB ICC Profile, http://www.srgb.com/c55.pdf
C. Poynton, Frequently Asked Questions about Color, http://www.inforamp.net/~poynton/ColorFAQ.html, 1999
C. Poynton, Frequently Asked Questions about Gamma, http://www.inforamp.net/~poynton/GammaFAQ.html, 1999
G. Starkweather, Colorspace interchange using sRGB, http://www.microsoft.com/hwdev/tech/color/sRGB.asp, 2001
108
The End
- Question and Answer Session -