8/11/2019 2007.11.27 CS248-17 Color Theory
1/36
Color Theory
Kurt Akeley
CS248 Lecture 17
27 November 2007
http://graphics.stanford.edu/courses/cs248-07/
8/11/2019 2007.11.27 CS248-17 Color Theory
2/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Introduction
Difficulties:
Im learning this too
Terminology is used carelessly
There are lots of standardsCIE 1931, CIE 1964, Vos 1976, SMJ 1993,
Caveats:
Not comprehensive
Lots of CIE content, nothing on HSV or videoUnits may be off (or missing all together)
Derived plots may differ slightly from standards
8/11/2019 2007.11.27 CS248-17 Color Theory
3/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Human photoreceptors
www.stat.auckland.ac.nz/~ihaka/787/lectures-vision.pdf
Monochromaticscotopic vision
(low light levels)Chromaticphotopic vision
(high light levels)
There is a view direction(despite what I told you).
It doesnt affect theprojection, but it does
affect the nature of thereceptor array.
8/11/2019 2007.11.27 CS248-17 Color Theory
4/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Humans are trichromats
Spectral sensitivities of human conesStockman, MacLeod, and Johnson
Journal of the Optical Society of AmericaVolume 10, Number 12, December 1993
Table 8
Monochromaticstimulus
Determined by chemistryand retinal coverage
LM
S
Monochromat: Horshoe crabsDichromat: dogs
Trichromat: people, most camerasTetrachromat: fancy camerasPentachromat: Mallard ducks
[L M S] = EvalSmjSRF(lambda);[0.0197 0.0372 0.0104] =EvalSmjSRF(470);
All three contributions arenon-zero (the plots overlap)!
8/11/2019 2007.11.27 CS248-17 Color Theory
5/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Luminosity function
Sum of L, M, and Sresponses for photopic
vision ?(FvD pp. 576)
8/11/2019 2007.11.27 CS248-17 Color Theory
6/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Comparison of luminosity functions
Derived from SMJspectral-response data by
simple addition
From Wikipedia
Yes, the units are
different. We areinterested in the shapes.
8/11/2019 2007.11.27 CS248-17 Color Theory
7/36CS248 Lecture 17 Kurt Akeley, Fall 2007
Luminous efficacy (and efficiency)
How much of the
radiated energy(efficacy/efficiency)or wall-socketenergy (overallefficacy/efficiency)of a light source isusable for vision?
Integrate the product ofthe luminosityfunction with thespectrum of the lightsource.
Source: Wikipedia
8/11/2019 2007.11.27 CS248-17 Color Theory
8/36CS248 Lecture 17 Kurt Akeley, Fall 2007
Metamers
Response is linear
So response to an energy spectrum is the sum of the responses tothe individual spectral components
Same integration as for luminous efficiency, but doneseparately for L, M, and S, rather than for their sum
Many different spectra will produce the same L,M,S responseThese spectra are metamers
Metamers are form of aliasing : undersampling (only three conetypes) causes different signals to appear equivalent
This aliasing is very convenient
8/11/2019 2007.11.27 CS248-17 Color Theory
9/36CS248 Lecture 17 Kurt Akeley, Fall 2007
CIE 1931 RGB primaries
B=435 nm
G=546 nm
R =700 nm[L M S] = EvalSmjSRF(700)*Sr +EvalSmjSRF(546)*Sg +EvalSmjSRF(435)*Sb);
M = [ EvalSmjSRF(700)EvalSmjSRF(546)EvalSmjSRF(435) ];
R = 1;G = 1;B = 1;
[L M S] = [R G B] * M;
8/11/2019 2007.11.27 CS248-17 Color Theory
10/36CS248 Lecture 17 Kurt Akeley, Fall 2007
RGB color-matching function
M = [ EvalSmjSRF(700)EvalSmjSRF(546)EvalSmjSRF(435) ];
R = 1;G = 1;B = 1;
[L M S] = [R G B] * M;
[R G B] = [L M S] * Minv;
CMF(lambda) = EvalSmjSRF(lambda) * Minv;
What proportion of the R, G, and B primaries is required to matcha spectral color?
8/11/2019 2007.11.27 CS248-17 Color Theory
11/36CS248 Lecture 17 Kurt Akeley, Fall 2007
RGB color-matching function
Primary amplitudesare adjusted to give
equal areas under allthree color-matching
curves
Oops, what is anegative primary
contribution?
8/11/2019 2007.11.27 CS248-17 Color Theory
12/36CS248 Lecture 17 Kurt Akeley, Fall 2007
RGB color-matching function
W = DomainSmjSRF(1);len = length(W);% compute M assuming equal-intensity primaries
M = [ EvalSmjSRF(Rnm) * 1EvalSmjSRF(Gnm) * 1EvalSmjSRF(Bnm) * 1];
Minv = inv(M);% integrate the color-matching functionCMFsum = [0 0 0];for n = 1 : len
CMFsum = CMFsum + EvalSmjSRF(W(n)) * Minv;end% recompute M such that the color-matching curves have equal integrals% this amounts to scaling the primary intensities by Rs, Gs, and BsRs = CMFsum(1) / CMFsum(3);Gs = CMFsum(2) / CMFsum(3);Bs = 1;
M = [ EvalSmjSRF(Rnm) * Rs
EvalSmjSRF(Gnm) * GsEvalSmjSRF(Bnm) * Bs]; Minv = inv(M);
% compute the color-matching functionCMF = zeros(len, 3);for n = 1 : len
CMF(n,:) = EvalSmjSRF(W(n)) * Minv;end
[390 391 392 729 730]
8/11/2019 2007.11.27 CS248-17 Color Theory
13/36CS248 Lecture 17 Kurt Akeley, Fall 2007
Negative primaries
Cant add a negative primary amount
So a negative match adds the (opposite of) the negative amount tothe source being matched, rather than to the matching light
Sensible but awkward
8/11/2019 2007.11.27 CS248-17 Color Theory
14/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
CIE 1931 XYZ primaries
Derived by linear transformation from the RGB primaries:
The matrix coefficients were (obviously) chosen carefully
Well see some of the desirable properties in later slides
The XYZ primaries are imaginaryThey do not correspond directly to amounts of light
But they are very useful
[ ] [ ]
0.49 0.17697 0.001
0.31 0.81240 0.010.17697
0.20 0.01063 0.99
X Y Z R G B
=
8/11/2019 2007.11.27 CS248-17 Color Theory
15/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
CIE 1931 XYZ color-matching function
Intended property:Y = luminosity
Intended property:non-negative
8/11/2019 2007.11.27 CS248-17 Color Theory
16/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
A special metamer
400 nm 700 nm
Energy density
wd
e1
e2
Dominant wavelength = wd
Excitation purity = (e 2-e 1) / (e 2+e 1)
Luminance is related to the integration of thespectrum (as we saw before)
These determinechromaticity
8/11/2019 2007.11.27 CS248-17 Color Theory
17/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
XYZ chromaticity
Rescale X, Y, and Z to remove luminance, leaving chromaticity:
Because the sum of the chromaticity values x, y, and z is always1.0, a plot of any two of them loses no information
Such a plot is a chromaticity plot
X Y Z x y z
X Y Z X Y Z X Y Z = = =
+ + + + + +
8/11/2019 2007.11.27 CS248-17 Color Theory
18/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
xz chromaticity
Youve never seen thisplot, but it is perfectly
valid. The standardplots the x and y
chromaticity values.
8/11/2019 2007.11.27 CS248-17 Color Theory
19/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
CIE 1931 xy chromaticity (derived from SMJ data)
Intended property:non-negative
Intended property:white point at(1/3, 1/3, 1/3)
Intended property:fitted to edge of right
triangle
8/11/2019 2007.11.27 CS248-17 Color Theory
20/36
8/11/2019 2007.11.27 CS248-17 Color Theory
21/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
CIE 1931 rg chromaticity (derived from SMJ data)
Intended property:white point at(1/3, 1/3, 1/3)
8/11/2019 2007.11.27 CS248-17 Color Theory
22/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
rb chromaticity (derived from SMJ data)
Intended property:white point at(1/3, 1/3, 1/3)
8/11/2019 2007.11.27 CS248-17 Color Theory
23/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Gamut
Gamut is the chromaticities that can be generated by a set ofprimaries
Because everything weve done is linear, interpolation betweenchromaticities on a chromaticity plot is also linear
Thus the gamut is the convex hull of the primary chromaticities
What is the gamut of the CIE 1931 primaries?
8/11/2019 2007.11.27 CS248-17 Color Theory
24/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
CIE 1931 RGB gamut
R = 700 nm
G = 546 nm
B = 438 nm
All dominant wavelengthscan be reproduced, butmany cannot reach full
saturation.
No finite set of primariescan reproduce the entire
gamut. But more primariesdo a better job.
So the colors on the xychromaticity diagram cannot
be correct, because nodisplay can accurately
reproduce them!
8/11/2019 2007.11.27 CS248-17 Color Theory
25/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
MATLAB code
RGBr = EvalSmjSRF(Rnm) * Minv;RGBg = EvalSmjSRF(Gnm) * Minv;RGBb = EvalSmjSRF(Bnm) * Minv;XYZr = RGBr * CieM;XYZg = RGBg * CieM;
XYZb = RGBb * CieM;xyzr = XYZr / (XYZr(1) + XYZr(2) + XYZr(3));xyzg = XYZg / (XYZg(1) + XYZg(2) + XYZg(3));xyzb = XYZb / (XYZb(1) + XYZb(2) + XYZb(3));
plot([xyzr(1) xyzg(1) xyzb(1) xyzr(1)], ...[xyzr(2) xyzg(2) xyzb(2) xyzr(2)], ...
c. -', 'linewidth', lw);
8/11/2019 2007.11.27 CS248-17 Color Theory
26/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Short-persistence phosphor CRT gamut
8/11/2019 2007.11.27 CS248-17 Color Theory
27/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Long-persistence phosphor CRT gamut
8/11/2019 2007.11.27 CS248-17 Color Theory
28/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
LCD projector gamut (hypothetical)
8/11/2019 2007.11.27 CS248-17 Color Theory
29/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
MATLAB and dichroic filter source
RGBr = [0 0 0];RGBg = [0 0 0];RGBb = [0 0 0];for n = 1 : len
TF = EvalDichroicRgbTF(W(n));RGBr = RGBr + (TF(1) .* CMF(n,:));RGBg = RGBg + (TF(2) .* CMF(n,:));RGBb = RGBb + (TF(3) .* CMF(n,:));
endXYZr = RGBr * CieM;XYZg = RGBg * CieM;XYZb = RGBb * CieM;xyzr = XYZr / (XYZr(1) + XYZr(2) + XYZr(3));xyzg = XYZg / (XYZg(1) + XYZg(2) + XYZg(3));xyzb = XYZb / (XYZb(1) + XYZb(2) + XYZb(3));
plot([xyzr(1) xyzg(1) xyzb(1) xyzr(1)], ...[xyzr(2) xyzg(2) xyzb(2) xyzr(2)], ...
c. -', 'linewidth', lw);
Image from www.edmundoptics.com
Realistic primaries havewide spectrums. Why?
Assumes projectorlight has flat
spectrum (wrong)
8/11/2019 2007.11.27 CS248-17 Color Theory
30/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Subtractive color
We have been adding primaries with spectra that are (almost)
mutually exclusiveThis works for displays, but not for printing
It could work for printing, if dye were reflective and couldbe placed in very small, non-overlapping, regions
But (I guess) this doesnt work well, so instead ink isdesigned to block light, and to be mixed on the surface of awhite page
Typical (additive) RGB filters have transmission functions like these:
What would you expect the transmission functions of subtractivefilters to look like?
8/11/2019 2007.11.27 CS248-17 Color Theory
31/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Subtractive color
Image from www.edmundoptics.com
8/11/2019 2007.11.27 CS248-17 Color Theory
32/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Additive and subtractive primaries
The statement that the additive primaries are red, green, andblue is clearly incorrect
Any set of three non-colinear primaries yields a gamut
Primaries that appear red, green, and blue are a goodchoice, but not the only choice
Additional (non-colinear) primaries are always betterLikewise, the statement that the subtractive primaries are
magenta, cyan, and yellow is also incorrect, for the samereasons
Subtractive primaries must collectively block the entirevisible spectrum, but many sets of blockers that do so areacceptable primaries
The use of black ink (the k in cmyk) is a good example
Modern ink-jet printers often have 6 or more ink colors
8/11/2019 2007.11.27 CS248-17 Color Theory
33/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Final thoughts
CIE RGB and CIE XYZ are color spaces
Many other color spaces, with different strengths and weaknesses,are possible
Refer to Marc Levoys 2006 CS248 lecture notes for many details: http://graphics.stanford.edu/courses/cs248-06/color/color1.html
8/11/2019 2007.11.27 CS248-17 Color Theory
34/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Summary
Perceived color is the ratio of (linear) L, M, and S stimulation
It is not possible to distinguish between metamers
Three degrees of freedom need for (at least) three primaries
Everything derives from the human spectral-response function
Luminosity function (I think)
Reasonable choices for primariesColor-matching functions (RGB and XYZ)
Chromaticity diagrams (rg and xy)
Three primaries cannot reproduce the entire human gamut
Use chromaticity diagram to understand what can be reproducedSubtractive colors
Are a convenient fiction (like holes in semiconductor theory)
The true color arithmetic is unchanged
8/11/2019 2007.11.27 CS248-17 Color Theory
35/36
CS248 Lecture 17 Kurt Akeley, Fall 2007
Assignments
Next lecture: Some combination of lighting theory and z-buffertheory, TBD (Thursday 29 November)
Reading assignment: none (work on your projects)
8/11/2019 2007.11.27 CS248-17 Color Theory
36/36
End