Color
ECE 847:Digital Image Processing
Stan BirchfieldClemson University
Acknowledgment
Many slides
are courtesy of Bill Freeman at MIT
and
David Forsyth
at UC Berkeley
from http://www-static.cc.gatech.edu/classes/AY2007/cs4495_fall/html/materials.html
How it all began
An aside
Tyrannosaurus
Allosaurus
Titanosaurus
65 feet (L)
50 feet (L)
40 feet (L)
American football field: 300 feet x 160 feet
Ark: 450 feet x 75 feet
Height: 45 feet
http://dinodictionary.comhttp://www.kickoffzone.com/articles/images/ClemsonMemorialStadium02.jpg
Visible Spectrum
Physically, the colors are linear:
electromagnetic (EM) spectrum380 nm720 nm
Question
• Why then does violet look like red mixed with blue?
• Red and blue are at extreme ends of the spectrum
• Should have the least in common
380 nm720 nm
Answer
Psychologically, the colors are circular:
Newton chose 7 colors (ROYGBIV)because 7 is a perfect number
6 colors fits the data better(what is indigo anyway?)
This is the famous color wheel
Color in music
De Clario’s color music code
http://home.vicnet.net.au/~colmusic/clario1.htm
Color and moodsintense
peaceful,depressing
calm,natural
happy,optimistic
royal,wealthy
attention
http://www.infoplease.com/spot/colors1.html
http://www.cs.brown.edu/courses/cs092/VA10/HTML/GoethesTriangleExplanation.htmlGoethe’s color triangle
Physics of color
Forsyth, 2002Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995
Illumination spectra Reflectance spectra
blue skylight
tungsten bulb
Color names for cartoon spectra
400 500 600 700 nm
400 500 600 700 nm
400 500 600 700 nm
red
gree
nbl
ue
400 500 600 700 nm
cyan
mag
enta
yell
ow
400 500 600 700 nm
400 500 600 700 nm
http://groups.csail.mit.edu/graphics/classes/CompPhoto06/html/lecturenotes/Color.ppt
MetamerTwo colors are metamers if they have• different spectral distributions• same visual appearance
http://escience.anu.edu.au/lecture/cg/Color/Image/metamer.gif
Trichromacy
Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995
In the human visual system, every color can be obtained as the linear combination of three independent primary colors
Color matching experiment 1
http://groups.csail.mit.edu/graphics/classes/CompPhoto06/html/lecturenotes/Color.ppt
Color matching experiment 1
p1 p2 p3
The primary color amounts needed for a match
Color matching experiment 1
p1 p2 p3
The primary color amounts needed for a match
Color matching experiment 1
p1 p2 p3
The primary color amounts needed for a match
Color matching experiment 2
Color matching experiment 2
p1 p2 p3
Color matching experiment 2
p1 p2 p3
Color matching experiment 2
p1 p2 p3 p1 p2 p3
We say a “negative” amount of p2 was needed to make the match, because we added it to the test color’s side.
The primary color amounts needed for a match:
p1 p2 p3
Superposition principle
Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995
Grassman’s Laws• For color matches:
– symmetry: U=V <=>V=U– transitivity: U=V and V=W => U=W– proportionality: U=V <=> tU=tV– additivity: if any two (or more) of the statements
U=V, W=X, (U+W)=(V+X) are true, then so is the third
• I.e., additive color matching is linear
• Not true at extreme ends of measurementsForsyth & Ponce
where
Do two people see the same color?
• Yes!
• In the following sense:They will choose the same weights for the three primaries to match the color
• Not true for color-blind people, of course
Rods and cones
http://en.wikipedia.org/wiki/Trichromatic_color_vision
• Young-Helmholtz theory (early 1800s): Color vision is the result of three different photoreceptors• Experimentally confirmed (1980s) by measuring the cone response functions from the photoreceptors
Tetrachromacy
• At low light levels, rod cells may contribute to color vision
• Studies suggest that some people may have four cones
• Some animals (e.g., shrimp) have more than four cones
Measure color by color-matching paradigm
• Pick a set of 3 primary color lights.• Find the amounts of each primary, e1, e2, e3,
needed to match some spectral signal, t.• Those amounts, e1, e2, e3, describe the color
of t. If you have some other spectral signal, s, and s matches t perceptually, then e1, e2, e3 will also match s, by Grassman’s laws.
• Why this is useful—it lets us:– Predict the color of a new spectral signal– Translate to representations using other primary
lights.
http://groups.csail.mit.edu/graphics/classes/CompPhoto06/html/lecturenotes/Color.ppt
Goal: compute the color match for any color signal for any set of
primary colors
• Examples of why you’d want to do that:– Want to paint a carton of Kodak film with the
Kodak yellow color.– Want to match skin color of a person in a
photograph printed on an ink jet printer to their true skin color.
– Want the colors in the world, on a monitor, and in a print format to all look the same.
How to compute the color match for any color signal for any set of
primary colors
• Pick a set of primaries, • Measure the amount of each primary, needed
to match a monochromatic light, at each spectral wavelength (pick some spectral step size). These are called the color matching functions.
)(),(),( 321 ppp)(),(),( 321 ccc
)(t
Color matching functions for a particular set of monochromatic
primariesp1 = 645.2 nmp2 = 525.3 nmp3 = 444.4 nm
Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995
Using the color matching functions to predict the primary match to a new
spectral signalWe know that a monochromatic light of wavelength will be matched by the amounts
of each primary.
i)(),(),( 321 iii ccc
)(
)( 1
Nt
t
t
And any spectral signal can be thought of as a linear combination of very many monochromatic lights, with the linear coefficient given by the spectral power at each wavelength.
Using the color matching functions to predict the primary match to a new
spectral signal
)()(
)()(
)()(
313
212
111
N
N
N
cc
cc
cc
C
Store the color matching functions in the rows of the matrix, C
)(
)( 1
Nt
t
t
Let the new spectral signal be described by the vector t.
Then the amounts of each primary needed to match t are:
tC
Internal review
• So, for any set of primary colors, if we are given the spectral color matching functions for a set of primary lights
• We can calculate the amounts of each primary needed to give a perceptual match to any spectral signal.
Suppose you use one set of primaries and I use another?
• We address this in 2 ways:– Learn how to translate between
primaries– Standardize on a few sets of favored
primaries.
How do you translate colors between different systems of primaries?
p1 = (0 0 0 0 0… 0 1 0)T
p2 = (0 0 … 0 1 0 ...0 0)T
p3 = (0 1 0 0 … 0 0 0 0)T
Primary spectra, P Color matching functions, C
p’1 = (0 0.2 0.3 4.5 7 …. 2.1)T
p’2 = (0.1 0.44 2.1 … 0.3 0)T
p’3 = (1.2 1.7 1.6 …. 0 0)T
Primary spectra, P’Color matching functions, C’
tC
Any input spectrum, tThe amount of each primary in P needed to match the color with spectrum t.
tCCP
''
The spectrum of a perceptual match to t, made using the primaries P’
The color of that match to t, described by the primaries, P.
The amount of each P’ primary needed to match t
So, how to translate from the color in one set of
primaries to that in another:
''eCPe
P’ are the old primariesC are the new primaries’ color matching functions
C
P’
a 3x3 matrix
The values of the 3 primaries, in the primed system
The values of the 3 primaries, in the
unprimed system
And, by the way, color matching functions translate like this:
''CCPC
But this holds for any input spectrum, t, so…
a 3x3 matrix that transforms from the color representation in one set of primaries to that of another.P’ are the old primaries
C are the new primaries’ color matching functions
C
P’
tC
tCCP
''From earlier slide
How to use this?
• Given two sets of primaries, P and P’
• Measure color matching functions C and C’
• Solve C=FC’ for the 3x3 matrix F
• F now converts between tristimulus values: e = Fe’
Human eye photoreceptor spectral sensitivities
Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995
What colors would these look like?
Are the color matching functions we observe obtainable from some 3x3 matrix transformation of the human photopigment response curves? (Because that’s how color matching functions translate).
Color matching functions (for a particular set of spectral
primaries
Comparison of color matching functions with best 3x3 transformation
of cone responses
Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995
Internal summary
• What are colors? – Arise from power spectrum of light.
• How represent colors: – Pick primaries– Measure color matching functions (CMF’s)– Matrix mult power spectrum by CMF’s to find
color as the 3 primary color values.• How share color descriptions between
people?– Translate colors between systems of primaries– Standardize on a few sets of primaries.
CIE 1931 standard colorimetric observer (2o)
• Commission internationale de l'éclairage (CIE)• Used primaries:
– Red: 700 nm– Green: 546.1 nm– Blue: 435.8 nm
• 2o standard observer• Now considered out of date, but still widely used –
1964 supplementary standard colorimetric observer (10o)• Procedure:
– Show pure color to observer– Match using primaries weights for RGB– Transform from RGB to XYZ
(XYZ are imaginary primaries; in XYZ, all weights are positive)
(using NTSC primaries)
CIE Chromaticity diagramNormalize: x = X / (X+Y+Z) y = Y / (X+Y+Z) z = 1 – x – y
spectral locus
line of purples
gamut of device is
convex hull of primaries
Note: It is misleading to draw colors on the chromaticity diagram (not recommended), but it makes the slide pretty
CIE Chromaticity diagram
With 3 fixed primaries,
any color can be matched
(allowing negative weights)
CIE Chromaticity diagram
But with just 2 primaries,
any color can also be matched
(if the primaries can be moved)
CIE Chromaticity diagram
Complementary colors are on
opposite sides
CIE Chromaticity diagram
Natural encoding of color for perception:• hue (dominant wavelength)
• saturation (distance from edge)
• value (height out of plane)
Notice similarity to color wheel
R
C
Y
G
M
B
Color spaces• RGB
– orthogonal axes– usually 8 bits each
(0 – 255)– natural for capture
and display H/W (cameras, monitors)
R
G
B
CCIR Rec. 601 was used for television(0.299 0.587 0.114)
CCIR Rec. 709 defines RGB for HDTV and is used by all modern devices(0.2125 0.7154 0.0721)
Color spaces• Turn the RGB cube
on its side• Hexagon border is
color wheel• white / black are out
of page
R
C
Y
G
M
B
R
C
Y
G
M
B
http://viz.aset.psu.edu/gho/sem_notes/color_2d/html/primary_systems.html
Color spaces
http://viz.aset.psu.edu/gho/sem_notes/color_2d/html/primary_systems.html
R
C
Y
G
M
B
• This is HLS (hue lightness saturation)
Color spaces
http://viz.aset.psu.edu/gho/sem_notes/color_2d/html/primary_systems.html
• Rescale HLS to get HSV (hue saturation value)
• Also called HIS• How would you describe a
color?– dominant wavelength (hue)– purity (saturation)– brightness (value)
• Transformation RGB HSV is nonlinear
Color spaces• Y’CbCr color differences
– Y’ is luma component– Cb is blue chroma component– Cr is red chroma component
• YUV is not well defined• Usually YUV means scaled version of Y’CbCr
For CCIR Rec. 601, (LumaRed, LumaGreen, LumaBlue) = (0.299 0.587 0.114)
Color spaces• American analog television transmission (NTSC)
uses YIQ color space:– originally black-and-white television (only Y)– IQ added later, modulated on top of Y for backward
compatibility
• European joke: “Never twice the same color”
Color spaces
• We have already seen CIE xyz
• Based on a direct graph of the original X, Y and Z tristimulus functions
• Problem: Too muchspace is allocated to greens
http://www.cambridgeincolour.com/tutorials/color-spaces.htm
Color spaces
• Ask subject to match test color• All matches fall within ellipse on
chromaticity diagram• These are MacAdam ellipses• They capture “just noticeable
difference”• Note: Color differences don’t
make sense for largedistances – Is red more likegreen or blue?
http://en.wikipedia.org/wiki/MacAdam_ellipse
Color spaces
• Solution: CIE Lu’v’
• Perceptually uniform space
• Colors are distributed proportional to their perceived color difference
http://www.cambridgeincolour.com/tutorials/color-spaces.htm
Color spaces• CIE La*b* (1976) transforms the colors so
that they extend equally on two axes• Color space is now a square• Each axis represents
an easily recognizable property of color:– red-green blend – blue-red blend– blue-green blend
http://www.cambridgeincolour.com/tutorials/color-spaces.htm
Int’l Color Consortium (ICC)• ICC established in 1993 to create an open,
standardized color management system• Now used in most computers• Systems involves three key concepts:
– color profiles– color spaces– translation between color spaces
http://www.cambridgeincolour.com/tutorials/color-management1.htm
One final color space
• So far, we have been assuming additive colors (light)
• Now let us consider subtractive colors (pigments)
• Pigments work similarly but are highly nonlinear
Color spaces• CMYK is used for printers• Subtractive color• Black (K) is separate because it is very
difficult to get good black by mixing other colors
• In theory,
• But in practice much more complicated
Gamut• Recall: gamut is the range of colors
that a device can display
• Monitor’s gamut is triangle, because additive colors (light) follow Grassman’s laws
• More complicated for printers, film
http://www.imaging-resource.com/PRINT/PPM200/PPM200vsP400.gif
http://www.cse.fau.edu/~maria/COURSES/COP4930-GS/ColorFigs/Mvc-061s.jpg
Paint mixing
• This is why paint stores use many more than three paints for mixing (~12)
http://whites-autorepair.com/images/paintmixroom.jpghttp://www.albert-tague.com/inc/colour-mixer2.jpg
Additive and Subtractive Colors
additive
subtractive(but pigments are nonlinear)
RGB
CMYNote: Order of colors is the same in both cases
This leads us to an important question
What are the primary colors?
• As children, we learn RYB
• Then we’re told RGB
• When asked about the discrepancy, we’re told CMY is the same as RYB
Something about this is unsettling
• Yellow still appears to be pure– Even when you know that green and red make
yellow,– It is impossible to believe
• In fact, red, yellow, blue, and green all appear pure
• So do black and white• Could there be six
primary colors?
Limitations of component theories
• So far we have discussed component theories of color
• Component theories are unsatisfying because they do not describe our subjective experience well
• Psychologically,– violet looks like a combination of red and blue– yellow does not look like a combination of red
and green– black and white do not look like combinations
of other colors
Opponent colors• Opponent-process color theory (Hering 1872)• Six primary psychological colors:
• Each color looks pure• No such thing as
– reddish green (inevitably becomes yellowish green), or– yellowish blue (inevitably becomes yellowish-green)
• Every other color is a combination of these six
http://en.wikipedia.org/wiki/Opponent_process
Both are true
• Controversy raged for 100 years between – component theories– opponent color theory
• Both are true (experimentally verified):– three photoreceptors provide components– later cells transform to opponent color space
(Ballard and Brown)
Final thought
Piet Mondrian, Composition with Yellow, Blue, and Red, 1921http://en.wikipedia.org/wiki/Piet_Mondrian
Poynton definitions
• intensity, brightness, lightness, luma, luminance, white
Gamma correction
Blackbody radiators
Fluorescence
http://en.wikipedia.org/wiki/Image:AgarosegelUV.jpg
Top Related