Introduction to color science
◼ Trichromacy
◼ Spectral matching functions
◼ CIE XYZ color system
◼ xy-chromaticity diagram
◼ Color gamut
◼ Color temperature
◼ Color balancing algorithms
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 1
Newton’s Prism Experiment - 1666
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 2
Color: visible range of the electromagnetic spectrum
380 nm 760 nm
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 3
Radiometric quantities
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 4
Photometric quantities
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 5
Human retina
[Roorda, Williams, 1999]
Pseudo-color image of nasal retina,
1 degree eccentricity, in two male subjects, scale bar 5 micron
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 6
Absorption of light in the cones of the human retina
535 nm 575 nm
445 nm
——𝐿: 𝑆𝑅 𝜆
——𝑀: 𝑆𝐺 𝜆
——𝑆: 𝑆𝐵 𝜆
Sensitivity
Note: curves are
normalized. Much lower
sensitivity to Blue, since
fewer S-cones absorb
less light.
Wavelength 𝜆 (nm)
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 7
Three-receptor model of color perception
S ( )C ( )d
R R
C ( ) S ( )C ( )d
G G Effective cone stimulation
(“tristimulus values”)
Spectral energy distribution
of incident light
S ( )C ( )d
B B
[T. Young, 1802] [J.C. Maxwell, 1890]
◼ Different spectra can map into the same tristimulus values
and hence look identical (“metamers”)
◼ Three numbers suffice to represent any color
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 8
Color matching
◼ Suppose 3 primary light sources with spectra Pk(λ), k =1,2,3
◼ Intensity of each light source can be adjusted by factor βk
◼ How to choose βk, k =1,2,3, such that desired tristimulus values (αR, αG, αB) result ?
()
C = S ( )C ( )d
R R i = Si ( ) 1 P1 ( )+ 2 P2 ( )+ 3P3 ( ) d
1 P1 ( )
S ( )C ( )d G = 1 K i,1 + 2 K i,2 + 3 K i,3
()
G
+ 2 P2
+ P ( )
3 3 S ( )C ( )d
B B () ()
with K i, j = Si Pj d
Color matching is linear!
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 9
Additive vs. subtractive color mixing
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 10
Color matching experiment
Eyes
Courtesy B. Wandell, from [Foundations of Vision, 1996]
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 11
Spectral matching functions
RGB Color Matching Functions
——𝑟 𝜆 ◼ Color matching experiment: Monochromatic test
light vs. mixture of 3 monochromatic primaries
——𝑔 𝜆
◼ “Negative intensity”: color is added to test color
——𝑏 𝜆
Tristimulus values
◼ CIE (Commision Internationale de L’Eclairage),
1931: Spectral RGB primaries (scaled, such that
Rλ=Gλ=Bλ matches spectrally flat white).
Wavelength 𝜆 (nm)
444.4 nm 526.3 nm 645.2 nm
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 12
Luminosity function
Monochromatic reference
test light light
Peak 555nm
Luminous efficiency
◼ Experiment:
Match the brightness of a white
reference light and a monochromatic
test light of wavelength λ
◼ Links photometric to radiometric
Wavelength 𝜆 (nm) quantities
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 13
CIE 1931 XYZ color system
XYZ Color Matching Functions Properties:
◼ All positive spectral matching functions
—— x(λ)
—— y(λ)
X .490 .310 .200 R
—— z(λ)
Y = .177 .813 .011 G
Tristimulus values
Z .000 .010 .990 B
◼ Y corresponds to luminance
◼ Equal energy white: X=Y=Z
◼ Virtual primaries
Wavelength 𝜆 (nm)
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 14
Color gamut and chromaticity
Z
X
x=
X +Y + Z
Y
Y y=
X +Y + Z
X+Y+Z=1
X
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 15
CIE chromaticity diagram
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 16
Perceptual non-uniformity of xy chromaticity
Just noticeable chromaticity
differences (10X enlarged)
[MacAdam, 1942]
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 17
Color gamut
NTSC phosphors
R: x=0.67, y=0.33
G: x=0.21, y=0.71
B: x=0.14, y=0.08
Reference white:
x=0.31, y=0.32
Illuminant C
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 18
It is possible to build a display that directly uses X, Y, Z as primary light
sources. XYZ Color Matching Functions
(a)nm
P1: 424 True (b) nm
P2: 570 False
——
——
—— realizable) primary light
With additive color mixing, how many (physically
sources are required to perfectly reproduce every possible color?
???
Tristimulus values
Z1+Z2 Y1+Y2 X1+X2
(a) 2 (b) 3 (c) 4 (d) 256 (e) infinitely many
What is the smallest number of monochromatic components needed to
generate light that appears white to a human observer?
(a) 1 (b) 2 (c) 3 (d) 4 (e) infinitely many
Wavelength 𝜆 (nm)
You may freely choose wavelength and intensity of each component.
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 19
White at different color temperatures
Tc(K) 3000 2500
2000
4000 1500
6000
10000
25000
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 20
Blackbody radiation
Planck’s Law Curves
——7000 K Planck’s Law, 1900
414 nm ——5770 K 2hc2 / 5
——4000 K BT ( ) = hc/ kT
BT(λ) (W m-2 sr-1 Hz-1)
e −1
Wien’s Law
503 nm 2,900,000
peak [nm] =
T[K ]
725 nm
Wavelength λ (nm)
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 21
Color balancing
◼ Effect of different illuminants can be cancelled only in the spectral domain (impractical)
◼ Color balancing in 3-d color space is practical approximation
◼ Color constancy in human visual system: gain control in cone space LMS [von Kries,1902]
◼ Von Kries hypothesis applied to image acquisition devices (cameras, scanners)
kL
L L’ Rγ
3x3 kM 3x3 γ
Camera
γ Gγ
M’ matrix
sensors matrix M
T1 S S’
T2 γ Bγ
kS
◼ How to determine kL, kM, kS automatically?
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 22
Color balancing (cont.)
◼ Von Kries hypothesis
L k L 0 0 L
M = 0 0 M
kM
S 0 k S S
0
◼ If illumination (or a patch of white in the scene) is known, calculate
Ldesired M S
kL = ; kM = desired ; kS = desired
Lactual M actual Sactual
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 23
Color balancing with unknown illumination
◼ Gray-world k L L x, y = k M M x, y =kS S x, y
x, y x, y x, y
◼ Scale-by-max
kL max L x, y = k M max M x, y = kS max S x, y
x, y x, y x, y
1 1 1
◼ Shades-of-gray p p p
k L L x, y = k M M x, y = k S S x, y
p p p
[Finlayson, Trezzi, 2004]
x,y x, y x,y
» Special cases: gray-world (p = 1), scale-by-max ( p = )
» Best performance for p ≈ 6
◼ Refinements:
smooth image, exclude saturated color/dark pixels,
use spatial derivatives instead (“gray-edge,” “max-edge”)
[van de Weijer, 2007])
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 24
Color balancing example
Original Gray-world Scale-by-max Gray-edge Max-edge Shades-of-gray
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 25
Color balancing example
Original Gray-world Scale-by-max
Gray-edge Max-edge Shades-of-gray
Original image courtesy Ciurea and Funt
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 26
Daylight D65 Daylight D65
CIE observer cheap camera
Illuminant A
CIE observer
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 27
Color conversion cheat sheet (e.g., for HW2)
◼ Great website for insights, every possible color conversion scheme, and much more:
[Link]
◼ Spectrum to CIE XYZ: CIE XYZ to CIE xyY:
(no illuminant)
R X
◼ CIE XYZ to CIE RGB: linear approximation of CIE gamma:
Glinear = M −1 Y
Blinear
Z R,G, B= R,G, B
1/
linear
X R
.490 .310 .200
= M
linear
◼ CIE RGB to CIE XYZ:
Y Glinear M = .177 .813 .011
Z Blinear .000 .010 .990
Image Processing: Huynh Trung Tru, © 2023 PTIT HCM -- Color 28