Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 39

Fundamentals of Multimedia, Chapter

Chapter 4
Color in Im a g e and
Video

1. Color Science
2. Color Models in Images
3. Color Models in Video
4. Further Exploration

1 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

4 . 1 C olor Science

L i g h t and S pe ctra

• L i g h t is an electromagnetic wave. Its color is characterized


by the wavelength content of the light.

(a) Laser light consists of a single wavelength: e.g., a ruby laser produces
a bright, scarlet-red beam.
(b) Mos t light sources produce contributions over many wavelengths.
(c) However, humans cannot detect all light, just contributions t h a t fall
in the “visible wavelengths”.
(d) Short wavelengths produce a blue sensation, long wavelengths pro-
duce a red one.

• S p e c t r o p h o t o m e t e r : device used t o measure visible light,


by reflecting light f r o m a diffraction grating ( a ruled surface)
t h a t spreads o u t the different wavelengths.
2 Li & Drew §c Prentice Hall
2003
Fundamentals of Multimedia, Chapter
4

• Figure 4.1 shows the phenomenon t h a t white light contains


all the colors of a rainbow.

Fig. 4.1: Sir Isaac Newton’s experiments.

• Visible light is an electromagnetic wave in the range 400 n m


t o 700 n m (where n m stands for nanometer, 10 − 9 meters).

3 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter 4

• Fig. 4.2 shows the relative power in each wavelength interval


for typical outdoor light on a sunny day. T h is type of curve
is called a Spectral Power Distribution ( S P D ) or a
spectrum .

• T h e symbol for wavelength is λ. T h i s curve is called


E(λ).
Spectral power
distribution

400 450 500 550 600 650 700


Wavelength (nm)
Fig. 4.2: Spectral power distribution of daylight.

4 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

H u m a n V ision

• T h e eye works like a camera, w i t h the lens focusing an


image o n t o the retina (upside-down and left-right
reversed).

• T h e retina consists of an array of rods and three kinds of


cones.

• T h e rods come in t o play when light levels are low and


produce a image in shades of gray ( “ a l l cats are gray a t
night!”).

• For higher light levels, the cones each produce a signal. Be-
cause of their differing pigments, the three kinds of cones
are m o s t sensitive t o red ( R ) , green ( G ) , and blue ( B ) light.

• I t seems likely t h a t the brain makes use of differences R-G,


G-B, and B - R , as well as combining all of R, G, and B in to
5 Li & Drew §c Prentice Hall
a high-light-level achromatic channel. 2003
Fundamentals of Multimedia, Chapter
4

Sp ectral Sensitivit y of t he E ye

• T h e eye is m os t sensitive t o light in the middle of the visible


spectrum.
• T h e sensitivity of our receptors is also a function of wave-
length ( F ig . 4.3 below).
• T h e Blue receptor sensitivity is n o t shown t o scale because
i t is much smaller than the curves for Red or Green — Blue
is a late addition, in evolution.
– Statistically, Blue is the favorite color of humans, regardless of na-
tionality — perhaps for this reason: Blue is a latecomer and thus is a
bit surprising!

• Fig. 4.3 shows the overall sensitivity as a dashed line — this


im p o r t a n t curve is called the luminous-efficiency function.
– I t is usually denoted V ( λ ) and is formed as the sum of the response
curves for Red, Green, and Blue.

6 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter 4

• The ro d sensitivity curve lo oks like t he luminous-


efficiency function V ( λ ) b u t is shifted t o the red end of the
spectrum.

• The achromatic channel pro duced by the cones is


approxi- mately proportional t o 2R + G + B/20.
1.0

V
0.8
Relative response
0.6

G
0.4

R
0.2

B
0.0

400 450 500 550 600 650 700

Wavelength (nm)

Fig. 4.3: R,G, and B cones, and Luminous


Efficiency curve V ( λ ) .
7 Li & Drew §c Prentice Hall
2003
Fundamentals of Multimedia, Chapter
4

• These spectral sensitivity functions are usually denoted by


letters other than “ R , tt, B ” ; here let’s use a vector function
q ( λ ) , w i t h components

q (λ) = (q R ( λ ) , qG(λ), q B ( λ ) )T (4.1)

• T h e response in each color channel in the eye is proportional


t o the number of neurons firing.

• A laser light a t wavelength λ would result in a certain n u m-


ber of neurons firing. A n S P D is a combination of single-
frequency lights (like “ las e rs ” ), so we add up the cone re-
sponses for all wavelengths, weighted by the eye’s relative
response a t t h a t wavelength.

8 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

• We can succinctly write dow n t his idea in t he for m of


an
integral:

R = E(λ)
q R (λ) dλ


tt = E ( λ ) q G (λ) ( 4 .2 )

dλ B = E(λ)

q B (λ) dλ

9 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

I m a g e F o rm a ti o n

• Surfaces reflect different amounts of light a t different wave-


lengths, and dark surfaces reflect less energy than light sur-
faces.

• Fig. 4.4 shows the surface spectral reflectance f r o m ( 1 )


orange sneakers and ( 2 ) faded bluejeans. T h e reflectance
function is denoted S ( λ ) .

10 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

Surface spectral reflectance


0.1 0.2 0.3 0.4 0.5 0.6 Sneakers

Jeans

400 450 500 550 600 650 700


Wavelength (nm)

Fig. 4.4: Surface spectral reflectance functions S ( λ ) for objects.

11 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

• Image formation is thus:

– L i g h t f r o m the illuminant w i t h S P D E ( λ ) impinges on a


surface, w i t h surface spectral reflectance function S ( λ ) ,
is reflected, and then is filtered by the eye’s cone
functions q ( λ ) .

– Reflection is shown in Fig. 4.5 below.

– T h e function C ( λ ) is called the color signal and consists


of the product of E ( λ ) , the illuminant, times S ( λ ) , the
reflectance:

C(λ) = E ( λ ) S(λ).

12 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

Fig. 4.5: Image formation model.

13 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

• T h e equations t h a t take in to account the image formation


model are:

R = E ( λ ) S ( λ ) q R (λ)


tt = E ( λ ) S ( λ ) q G (λ) ( 4 .3 )


dλ B = E(λ) S(λ)

q B (λ) dλ

14 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

C a m e r a Systems

• Camera systems are made in a similar fashion; a studio-


quality camera has three signals produced a t each pixel lo-
cation (corresponding t o a retinal position).

• Analog signals are converted t o digital, truncated t o


integers, and stored. If the precision used is 8-bit, then the
m a x imu m value for any of R, G, B is 255, and the m in i m u m
is 0.

• However, the light entering the eye of the computer user is


t h a t which is emitted by the screen — the screen is essentially
a self-luminous source. Therefore we need t o know the light
E ( λ ) entering the eye.

15 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

G a m m a Correction

• T h e light emitted is in f act roughly proportional t o the volt-


age raised to a power; this power is called g a m m a , w i t h
symbol γ.

(a) T h u s , if the file value in the red channel is R, the screen

emits light proportional t o R γ , w i t h S P D equal t o t h a t of


the red phosphor paint on the screen t h a t is the target
of the red channel electron gun. T h e value of gamma is
around 2.2.
(b) I t is customary t o append a prime t o signals t h a t are
g a m m a - c o rr e c t e d by raising t o the power (1/γ) before
transmission. T h u s we arrive a t linear signals:
R → R j = R 1/γ ⇒ (R j ) γ → R (4.4)

16 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

• Fig. 4. 6 (a ) shows light o u t p u t w i t h no gamma-correction


applied. We see t h a t darker values are displayed t o o dark.
T h is is also shown in Fig. 4.7(a), which displays a linear
ramp f r o m left t o right.

• Fig. 4 . 6 ( b ) shows the effect of pre-correcting signals by ap-


plying the power law R 1/γ ; i t is customary t o normalize volt-
age t o the range [0,1].

17 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

No gamma correction Gamma correction

1.
1.

0
0

0.
0.

8
8

0. 0.
0. 0.
Light

Light

6
6

4
4

0.
0.

2
2

0.
0.

0
0

0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0
Voltage Voltage

Fig. 4.6: ( a ) : Effect of C R T on light emitted f r o m screen


(voltage is normalized t o range 0..1). ( b ) : Gamma
correction of signal.

18 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter 4

• T h e combined effect is shown in Fig. 4 . 7( b ). Here, a


ramp is shown in 16 steps f r o m gray-level 0 t o gray-level
255.

Fig. 4.7: ( a ) : Display of ramp f r o m 0 t o 255, w i t h no


gamma correction. ( b ) : Image w i t h gamma correction
applied
19 Li & Drew §c Prentice Hall
2003
Fundamentals of Multimedia, Chapter
4

C ol or-Matc hi ng Functions

• Even w i t h o u t knowing the eye-sensitivity curves of Fig.4.3, a


technique evolved in psychology for matching a
combination of basic R, G, and B lights t o a given shade.

• T h e particular set of three basic lights used in an experiment


are called the set of color primaries.

• To m a t c h a given color, a subject is asked t o separately adjust


the brightness of the three primaries using a set of controls
until the resulting spot of light m o s t closely matches the
desired color.

• T h e basic situation is shown in Fig.4.8. A device for carrying


o u t such an experiment is called a colorimeter.

20 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

Red Room illumination


Green

Blue

Black
partition

White
Eye
screen

Light to be matched

Fig. 4.8: Colorimeter experiment.

21 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter 4

• T h e amounts of R, G, and B the subject selects t o m a t c h


each single-wavelength light forms the color-matching

curves. These are denoted r¯(λ), ¯g(λ), ¯b(λ) and are shown in
Fig. 4.9.
r¯(
b̄( )
)
Relative sensitivity

g¯ (
)

400 450 500 550 600 650 700


Wavelength (nm)

Fig. 4.9: CIE R G B color-matching functions ¯r(λ), ¯g(λ),


¯b(λ).

22 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

C I E Chromaticity D i a g r a m

• Since the ¯r(λ) color-matching curve has a negative lobe, a


set of fictitious primaries were devised t h a t lead t o color-
matching functions w i t h only positives values.

(a) T he resulting curves are show n in Fig. 4.10;


these are usually referred t o as the color-matching
( b ) functions.
T h e y are a 3 × 3 m a trix away f r o m r¯, ¯g , b curves, and
are denoted x¯(λ), y¯(λ), z¯(λ).

( c ) T h e m atrix is chosen such t h a t the middle standard color-


matching function y¯(λ) exactly equals the luminous-
efficiency curve V ( λ ) shown in Fig. 4.3.

23 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

Fig. 4.10: CIE standard X Y Z color-matching functions x¯(λ), y¯(λ), z¯(λ).

24 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

• F or a general SP D E ( λ ) , the essential “ color i m e t r i c ”


in- formation required t o characterize a color is
the set of tristimulus values X , Y , Z defined in analogy t o
( E q . 4.2)


X = E ( λ ) x¯(λ)


Y = E ( λ ) y¯(λ)
( 4 .6 )

dλ Z = E(λ)
• 3 D data is difficult t o visualize, so the CIE devised a 2 D
diagram based on z¯(λ) dλ
the values of ( X , Y, Z ) triples implied by
the curves in Fig. 4.10.

25 Li & Drew §c Prentice Hall


2003
CIE Chromaticity Diagram. This is an international standard for primary colors
established in 1931. It allows all other colors to be defined as weighted sum of the
three "primary" colors. ... The CIE diagram is a plot of X vs. Y for all visible colors.
Fundamentals of Multimedia, Chapter
4

• We go t o 2 D by factoring .o u t the m agnitude of


vectors ( X , Y, Z ) ; we could divide2 by X 2+ Y 2 + Z , but
divide by the sum X + Y + Z t o make the chromaticity:
weinstead

x = X/(X + Y +
Z ) y = Y/(X + Y
+ Z ) z = Z/(X + ( 4.7 )
Y + Z)
• T h i s effectively means t h a t one value o u t of the set (x, y, z)
is redundant since we have

X + Y +
x+ y+ z = ≡ 1 ( 4.8 )
Z X + Y
+ Z
so t h a t
z = 1 − x − ( 4 .9 )
y
28 Li & Drew §c Prentice Hall
2003
Fundamentals of Multimedia, Chapter
4

• Effectively, we are projecting each tristimulus vector ( X , Y, Z )


o n t o the plane connecting points (1, 0, 0 ) , (0, 1, 0 ) , and (0, 0,
1).
• Fig. 4.11 shows the locus of points for monochromatic light

1.0
0.8
0.6
y
0.4

700
0.2
0.0

400
0.0 0.2 0.4 0.6 0.8 1.0
x

Fig. 4.11: CIE chromaticity diagram.

29 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

(a) T h e color matching curves each add up t o the same


value
— t he area under each curve is the same f or
each of
x¯(λ), y¯(λ), z¯(λ).

(b) For an E ( λ ) = 1 for all λ, — an “equi-energy white l i g h t ”


— chromaticity values are (1/3, 1/3). Fig. 4.11
displays a typical actual white po in t in the middle of the
diagram.

(c) Since x, y ≤ 1 and x + y ≤ 1, all p ossible


ch r o m a t ic i ty values lie below the dashed diagonal line in
Fig. 4.11.

30 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

• T h e CIE defines several “ w h i t e ” spectra: illuminant A ,


illu- minan t C, and standard daylights D 6 5 and D 100 .
(F ig . 4.12)

Spectral power distribution

D100 A

C
D65

F2

400 450 500 550 600 650 700


Wavelength (nm)

Fig. 4.12: Standard illuminant SPDs.

31 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

• Chromaticities on the spectrum locus ( t h e “horseshoe” in


Fig. 4.11) represent “ p u r e ” colors. These are the m o st “ s a t -
u r a t e d ” . Colors close t o the white p o int are more unsatu-
rated.

• T h e chromaticity diagram: for a mixture of t w o lights, the


resulting chromaticity lies on the straight line joining the
chromaticities of the t w o lights.

• T h e “ d o m i n a n t wavelength” is the position on the spectrum


locus intersected by a line joining the white p oin t t o the
given color, and extended through i t .

32 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

Color M onitor Sp ecifications

• Color monitors are specified in part by the white po in t chro-


maticity t h a t is desired if the RGB electron guns are all ac-
tivated a t their highest value (1.0, if we normalize t o [0,1]).

• T h ere are several monitor specifications in current use ( Ta -


ble 4.1).

33 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

Table 4.1: Chromaticities and White Points of Monitor Specifications

Red Green Blue W h i t e P oint


System xr yr xg yg xb yb xW yW
NTSC 0.67 0.33 0.21 0.71 0.14 0.08 0.3101 0.3162
SMPTE 0.630 0.340 0.310 0.595 0.155 0.070 0.3127 0.3291
EBU 0.64 0.33 0.29 0.60 0.15 0.06 0.3127 0.3291

NTSC stands for National Television Standards Committee.

SMPTE stands for the Society of Motion Picture and Television Engineers

EBU stands for European Broadcasting Union

34 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

Out-of-Gamut
C olors
• For any (x, y) pair we wish t o find t h a t RGB triple giving the
specified (x, y, z): We fo rm the z values for the phosphors,
via z = 1 − x − y and solve for RGB f r o m the phosphor
chromaticities.

• We combine nonzero values of R, G, and B via

x r xg xb R x
yr y b G = ( 4 .1 0 )
yg y B z
z r zg
zb

35 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

• If (x, y) [color w i t h o u t magnitude] is specified, instead of


derived as above, we have t o invert the matrix of phosphor
(x, y, z) values t o obtain RGB .

• W h a t do we do if any of the RGB numbers is negative? —


t h a t color, visible t o humans, is o u t - o f - g a m u t for our display.

1. On e meth od: simply use the closest in-gamut color


avail- able, as in Fig. 4.13.

2. Another approach: select the closest complementary


color.

36 Li & Drew §c Prentice Hall


2003
Fundamentals of Multimedia, Chapter
4

1.0
Green

0.8
0.6
y
(a)
0.4

(b)
Red
0.2

Blue
0.0

0.0 0.2 0.4 0.6 0.8 1.0


x
Fig. 4.13: Approximating an out-of-gamut
color by an in-gamut one.
T h e out-of-gamut color shown by a triangle is approximated by the in-
tersection of ( a ) the line from t h a t color t o the white point with ( b ) the
boundary of the device color gamut.
37 Li & Drew §c Prentice Hall
2003
Fundamentals of Multimedia, Chapter
4

• Additive color results f r o m self-luminous sources, such as


lights projected on a white screen, or the phosphors glowing
on the mon itor glass. (Subtractive color applies for printers,
and is very different).

• Fig. 4.13 above shows the triangular g a m u t for the N T S C


system, drawn on the CIE diagram — a monito r can display
only the colors inside a triangular g a m ut .

39 Li & Drew §c Prentice Hall


2003

You might also like