Color and Image Formation 1
Color and Image Formation 1
Color
Asst. Prof. Dr. Meryem Erbilek
METU Lecture 1 - 1
Overview of Color
• Physics of color
• Human encoding of color
• Color spaces
• White balancing
METU Lecture 1 - 2
What is color?
• The result of interaction
between physical light in the
environment and our visual
system.
METU Lecture 1 - 3
Color and light
• When a beam of sunlight passes through a glass
prism, the emerging beam of light is not white but
consists instead of a continuous spectrum of colors
ranging from violet at one end to red at the other.
• White light: composed of almost equal energy in all
wavelengths of the visible spectrum.
METU Lecture 1 - 4
Electromagnetic Spectrum
METU Lecture 1 - 5
Visible Light
•Estimation of the wavelengths of electromagnetic
radiation emitted by a star is based on surface
temperature.
•For instance, since the surface of the sun is around
5800K, the peak of the sun’s emitted light lies in the
visible region. The Sun is the dominant source for visible-
light waves our eyes receive.
•A corona (outer-most layer of the Sun) is most easily https://sunearthday.nasa.gov/2007/multimedia/gal_007.php
seen during a total solar eclipse, since it is so faint and
the bright photosphere overwhelms it.
•As objects grow hotter, they radiate energy dominated
by shorter wavelengths, changing color. A flame on a
blow torch shifts from reddish to bluish in color as it is
adjusted to burn hotter. In the same way, the color of
stars tells scientists about their temperature.
METU Lecture 1 - 6
Visible Light
Plank’s law for Blackbody radiation
Surface of the sun: ~5800K
…because the
peak of the sun’s
emitted light lies in
the visible region
METU Lecture 1 - 7
The Physics of Light
88
© Stephen E. Palmer, 2002
The Physics of Light
Rel. power
Rel. power
Rel. power
Rel. power
99
© Stephen E. Palmer, 2002
The Physics of Light
Red
Slide partially based on Stanford U. CS131 From Foundation of Vision by Brian Wandell, Sinauer Associates, 1995
METU Lecture 1 - 11
Collects and processes information
from across the electromagnetic
spectrum.
1212
Interaction of light and surfaces
• What is the observed color of any surface under
monochromatic light (visible light of a narrow band
of wavelengths)?
https://www.youtube.com/watch?v=hd077pa-5CI
Slide partially based on Stanford U. CS131 Olafur Eliasson, Room for one color
METU Lecture 1 - 13 Slide by S. Lazebnik
James Turrell, a Californian artist, used light and color to
completely immerse people in a world where there was no
depth perception.
METU Lecture 1 - 16
Two types of light-sensitive receptors
Cones Rods
cone-shaped rod-shaped
less sensitive highly sensitive
operate in high light operate at night
color vision gray-scale vision
17
© Stephen E. Palmer, 2002
Rod / Cone sensitivity
Wavelength
metamers
20
Standardizing color experience
• We would like to understand which spectra
produce the same color sensation in people
under similar viewing conditions
• Color matching experiments
21
Foundations of Vision, by Brian Wandell, Sinauer Assoc., 1995
Color matching experiment 1
22
Source: W. Freeman
Color matching experiment 1
p1 p2 p3
23
Source: W. Freeman
Color matching experiment 1
p1 p2 p3
24
Source: W. Freeman
Color matching experiment 1
p1 p2 p3
25
Source: W. Freeman
Additive color mixing
Colors combine by
adding color spectra
Light adds to
existing black.
26
Source: W. Freeman
Color mixing
27
Source: W. Freeman
Examples of additive color systems
CRT phosphors
multiple projectors
http://www.jegsworks.com
28
http://www.crtprojectors.co.uk/
Color matching experiment 2
29
Source: W. Freeman
Color matching experiment 2
p1 p2 p3
30
Source: W. Freeman
Color matching experiment 2
p1 p2 p3
31
Source: W. Freeman
Color matching experiment 2
p1 p2 p3
p1 p2 p3 p1 p2 p3
32
Source: W. Freeman
Subtractive color mixing
Colors combine by
multiplying color
spectra.
Pigments remove
color from incident
light (white).
33
Source: W. Freeman
Examples of subtractive color systems
• Printing on paper
• Crayons
• Photographic film
34
Trichromacy
• In color matching experiments, most people can
match any given light with three primaries
– Primaries must be independent
• For the same light and same primaries, most
people select the same weights
– Exception: color blindness
• Trichromatic color theory
– Three numbers seem to be sufficient for encoding
color
– Dates back to 18th century (Thomas Young)
Slide partially based on Stanford U. CS131
METU Lecture 1 - 35
Overview of Color
• Physics of color
• Human encoding of color
• Color spaces
• White balancing
METU Lecture 1 - 36
Linear color spaces
• Defined by a choice of three primaries
• The coordinates of a color are given by the
weights of the primaries used to match it
METU Lecture 1 - 37
How to compute the weights of the primaries
to match any spectral signal
p1 p2 p3
38
Source: W. Freeman
Linear color spaces: RGB space
• Primaries are monochromatic lights (for monitors,
they correspond to the three types of phosphors)
• Subtractive matching required for some
wavelengths
RGB primaries RGB matching functions
39
Nonlinear color spaces: HSV
40
Overview of Color
• Physics of color
• Human encoding of color
• Color spaces
• White balancing
METU Lecture 1 - 41
White balance
• When looking at a picture on screen or print, we adapt to
the illuminant of the room, not to the scene in the picture!
• When the white balance is not correct, the picture will
have an unnatural color “cast”
incorrect white balance correct white balance
42
http://www.cambridgeincolour.com/tutorials/white-balance.htm
White balance
• Digital cameras:
• Automatic white balance
• White balance settings corresponding to
several common illuminants
• Custom white balance using a reference
object
• Film cameras:
• Different types of film or different filters for different
illumination conditions
43
http://www.cambridgeincolour.com/tutorials/white-balance.htm Slide: F. Durand
White balance
• Von Kries adaptation
44
Slide: F. Durand
White balance
• Von Kries adaptation
• Multiply each channel by a gain factor.
• Best way: gray card
• Take a picture of a neutral object (white or gray)
• Deduce the weight of each channel
– If the object is recoded as rw, gw, bw
use weights 1/rw, 1/gw, 1/bw
45
Slide: F. Durand
White balance
• Without gray cards: we need to “guess” which
pixels correspond to white objects
• Gray world assumption
• The image average rave, gave, bave is gray
• Use weights 1/rave, 1/gave, 1/bave
• Brightest pixel assumption (non-staurated)
• Highlights usually have the color of the light source
• Use weights inversely proportional to the values of the
brightest pixels
• Gamut mapping
• Gamut: convex hull of all pixel colors in an image
• Find the transformation that matches the gamut of the image
to the gamut of a “typical” image under white light
• Use image statistics, learning techniques
46
Slide: F. Durand
Uses of color in computer vision
Color histograms for indexing and retrieval
47
Swain and Ballard, Color Indexing, IJCV 1991.
Uses of color in computer vision
Skin detection
51