CS-184: Computer Graphics Lecture #2: Color Prof. James OBrien - - PowerPoint PPT Presentation

cs 184 computer graphics
SMART_READER_LITE
LIVE PREVIEW

CS-184: Computer Graphics Lecture #2: Color Prof. James OBrien - - PowerPoint PPT Presentation

CS-184: Computer Graphics Lecture #2: Color Prof. James OBrien University of California, Berkeley V2016-F-02-1.0 With material from Ren Ng and Steve Marschner Announcements Sign up for Piazza Assignment 0: due Friday, September


slide-1
SLIDE 1

CS-184: Computer Graphics

Lecture #2: Color

  • Prof. James O’Brien

University of California, Berkeley

V2016-F-02-1.0

With material from Ren Ng and Steve Marschner

2

Announcements

  • Sign up for Piazza
  • Assignment 0: due Friday, September 2nd., 11:59pm
  • See Piazza for class accounts
  • Email inst@eecs.berkeley.edu if unable to activate
  • Homework 1: due Wednesday, August. 31st, 1:00pm
  • Wait list...

02-Color.key - August 28, 2016

slide-2
SLIDE 2

3

Today

  • Color, Light, and Perception

4

What is Light?

  • Radiation in a particular frequency range

02-Color.key - August 28, 2016

slide-3
SLIDE 3

credit: Science Media Group.

6

Spectral Colors

  • Light at a single frequency
  • Also called monochromatic (an overloaded term)
  • Bright and distinct in appearance

R o y G. B i v Reproductions only, can’t show a real spectral color! White LED 02-Color.key - August 28, 2016

slide-4
SLIDE 4

Other Colors

7

Other Colors

8

Blue sky Solar disk

[Brian Wandell]

02-Color.key - August 28, 2016

slide-5
SLIDE 5

9

Other Colors

Robert A. Rohde

10

  • Most colors seen are a mix light of several frequencies

Other Colors

Image from David Forsyth

02-Color.key - August 28, 2016

slide-6
SLIDE 6

11

  • Most colors seen are a mix light of several frequencies

Other Colors

Image from David Forsyth

Reflected Light

12

[Stone 2003]

Φ(λ) = L(λ) × R(λ) dλ Φ(λ) L(λ)

R(λ)

02-Color.key - August 28, 2016

slide-7
SLIDE 7

Simple Model of a Detector

13

Φ(λ) S(λ) Φ(λ) × S(λ) s = Z Φ(λ) × S(λ) dλ

14

Perception -vs- Measurement

  • You do not “see” the spectrum of light
  • Eyes make limited measurements
  • Eyes physically adapt to circumstance
  • You brain adapts in various ways also
  • Weird psychological/psychophysical stuff also happens

02-Color.key - August 28, 2016

slide-8
SLIDE 8

15

Everything is Relative

16

Everything is Relative

02-Color.key - August 28, 2016

slide-9
SLIDE 9

17

Adapt

18

Adapt

02-Color.key - August 28, 2016

slide-10
SLIDE 10

19

Mach Bands

20

Everything’s Still Relative

02-Color.key - August 28, 2016

slide-11
SLIDE 11

Bezold Effect

21 22

Perception

The eye does not see intensity values...

02-Color.key - August 28, 2016

slide-12
SLIDE 12

The eye does not see intensity values...

23

Perception

The eye does not see intensity values...

24

Perception

02-Color.key - August 28, 2016

slide-13
SLIDE 13

25

Perception

26

Eyes as Sensors

  • The human eye contains cells that sense light
  • Rods
  • No color (sort of)
  • Spread over the retina
  • More sensitive
  • Cones
  • Three types of cones
  • Each sensitive to different frequency distribution
  • Concentrated in fovea (center of the retina)
  • Less sensitive

Image from Stephen Chenney

02-Color.key - August 28, 2016

slide-14
SLIDE 14

Eyes as Sensors

27

Monochromatic scotopic vision (low light levels) Chromatic photopic vision (high light levels)

Eyes as Sensors

28

02-Color.key - August 28, 2016

slide-15
SLIDE 15

30

Cones

  • Each type of cone responds to different range of

frequencies/wavelengths

  • Long, medium, short
  • Also called by color
  • Red, green, blue
  • Misleading:

“Red” does not mean your “red” cones are firing...

Normalized sensitivity curves

02-Color.key - August 28, 2016

slide-16
SLIDE 16

Recall

31

Φ(λ) S(λ) Φ(λ) × S(λ) s = Z Φ(λ) × S(λ) dλ

32

Cones

  • Response of a cone is given by a convolution integral :

continuous version of a dot product

l = X Φi × Li l = Z Φ(λ) × L(λ) dλ m = Z Φ(λ) × M(λ) dλ s = Z Φ(λ) × S(λ) dλ

02-Color.key - August 28, 2016

slide-17
SLIDE 17

33

Cones

  • You can see that “red” and “green” respond to more more

than just red and green...

Images from David Forsyth 34

Cones

  • Our perception of color is not evenly spaced in wavelength.

Images from David Forsyth

02-Color.key - August 28, 2016

slide-18
SLIDE 18

Cones

35

Marc Levoy

l = Z Φ(λ) × L(λ) dλ m = Z Φ(λ) × M(λ) dλ s = Z Φ(λ) × S(λ) dλ s m

l

Rods vs Cones

36

350 400 450 500 550 600 650 700 750 800 200 400 600 800 1000 1200 1400 1600 1800 Wavelength (nm) Luminous efficacy (lumens/watt) Scotopic (rod - dark adjusted) Photopic (cones - bright light)

02-Color.key - August 28, 2016

slide-19
SLIDE 19

37 38

Cones and Metamers

Cone response is an integral

Metamers: Different light input produce 
 same cone response

  • Different spectra look the same
  • Useful for measuring color

L = Z Φ(λ)L(λ)dλ M = Z Φ(λ)M(λ)dλ S = Z Φ(λ)S(λ)dλ

Φ1(λ), Φ2(λ) L, M, S

Brian Wandell

02-Color.key - August 28, 2016

slide-20
SLIDE 20

39

Trichromaticity

Eye records color by 3 measurements We can “fool” it with combination of 3 signals So display devices (monitors, printers, etc.) can generate perceivable colors as mix of 3 primaries

Cone Responses are Linear

  • Response to stimulus is
  • Response to stimulus is
  • Then response to is
  • Response to is

40

Φ1 (L1, M1, S1)

(L2, M2, S2) Φ2 Φ1 + Φ2

(L1 + L2, M1 + M2, S1 + S2) nΦ1 (nL1, nM2, nS1)

02-Color.key - August 28, 2016

slide-21
SLIDE 21

41

Additive Mixing

  • Given three primaries we agree on
  • Match generic input light with
  • Negative not realizable, but can add primary to test light
  • Color now described by
  • Example: computer monitor [RGB]

α, β, γ p1, p2, p3 Φ = αp1 + βp2 + γp3

CRT Primaries

42

Ren Ng

  • Curves determined by

phosphor emission properties

02-Color.key - August 28, 2016

slide-22
SLIDE 22

LCD Primaries

43

  • Curves determined

by (fluorescent) backlight and filters

44

Additive Color Matching

Show test light spectrum on left Mix “primaries” on right until they match The primaries need not be RGB

02-Color.key - August 28, 2016

slide-23
SLIDE 23

Experiment 1

45

Slide from Durand and Freeman 06

Experiment 1

46

p1 p2 p3 Slide from Durand and Freeman 06

02-Color.key - August 28, 2016

slide-24
SLIDE 24

Experiment 1

47

p1 p2 p3 Slide from Durand and Freeman 06

Experiment 1

48

p1 p2 p3 The primary color amounts needed for a match p1 p2 p3 The primary color amounts needed for a match Slide from Durand and Freeman 06

02-Color.key - August 28, 2016

slide-25
SLIDE 25

Experiment 2

49

Slide from Durand and Freeman 06

Experiment 2

50

p1 p2 p3 Slide from Durand and Freeman 06

02-Color.key - August 28, 2016

slide-26
SLIDE 26

Experiment 2

51

p1 p2 p3 Slide from Durand and Freeman 06

Experiment 2

52

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 Slide from Durand and Freeman 06

02-Color.key - August 28, 2016

slide-27
SLIDE 27

Color Matching Functions

53

Kayvon Fatahalian

λ

54

Color Matching Functions

¯ r(λ) ¯ g(λ) ¯ b(λ) Input wavelengths are CIE 1931 monochromatic primaries

02-Color.key - August 28, 2016

slide-28
SLIDE 28

Φ =    φ(λ1) . . . φ(λN)   

Using Color Matching Functions

  • For a monochromatic light of wavelength 


we know the amount of each primary
 necessary to match it:

  • Given a new light input signal
  • Compute the primaries necessary to match it

55

λi ¯ r(λi), ¯ g(λi),¯ b(λi)

Using Color Matching Functions

  • Given color matching functions in matrix form and new light
  • amount of each primary necessary to match is given by

56

¯ r(λ) ¯ g(λ) ¯ b(λ)

C =   ¯ r(λ1) . . . ¯ r(λN) ¯ g(λ1) . . . ¯ g(λN) ¯ b(λ1) . . . ¯ b(λN)  

Φ =    φ(λ1) . . . φ(λN)    r g b ! = C · Φ

02-Color.key - August 28, 2016

slide-29
SLIDE 29

Using Color Matching Functions

57

r g b !

CRT

= CCRT · Φ r g b !

LCD

= CLCD · Φ r g b !

LCD

= CLCD · C−P

CRT ·

r g b !

CRT

r g b !

LCD

= CCRT→LCD · r g b !

CRT

r g b !

display

= Cdisplay · r g b !

sRGB

58

CIE XYZ

Imaginary set of color primaries with positive values, X, Y, Z

02-Color.key - August 28, 2016

slide-30
SLIDE 30

59

Rescaled XYZ to xyz

Rescale X, Y, and Z to remove luminance, leaving chromaticity: Because the sum of the chromaticity values x, y, and z is always 1.0, a plot of any two of them loses no information Such a plot is a chromaticity diagram

x = X / ( X+Y+Z ) y = Y / ( X+Y+Z ) z = Z / ( X+Y+Z ) x+y+z = 1

CIE Chromaticity Diagram

60

Pure (saturated) spectral colors around the edge of the plot Less pure (desaturated) colors in the interior of the plot White at the centroid of the plot (1/3, 1/3)

02-Color.key - August 28, 2016

slide-31
SLIDE 31

Gamut

  • Gamut is the chromaticities generated by a set of primaries
  • Because everything we’ve done is linear, interpolation

between chromaticities 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?

61

CIE 1931 RGB Gamut

62

R = 700 nm G = 546 nm B = 438 nm

02-Color.key - August 28, 2016

slide-32
SLIDE 32

Other Gamuts (LCDs and NTSC)

63

  • Given three primaries we agree on
  • Make generic color with
  • Max limited by
  • Color now described by
  • Example: ink [CMYK]

64

Subtractive Mixing

α, β, γ W

Why 4th ink for black?

p1, p2, p3 Φ = W − (αp1 + βp2 + γp3)

02-Color.key - August 28, 2016

slide-33
SLIDE 33

Additive & Subtractive Primaries

65

Additive & Subtractive Primaries

  • Incorrect to say “the additive primaries are red, green, and

blue”

  • Any set of three non-collinear primaries yields a gamut
  • Primaries that appear red, green, and blue are a good choice, but not the
  • nly choice
  • Are additional (non-collinear) primaries always better?
  • Similarly saying “the subtractive primaries are magenta, cyan,

and yellow” is also incorrect, for the same reasons

  • Subtractive primaries must collectively block the entire visible spectrum,

but many sets of blockers that do so are acceptable “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

66

02-Color.key - August 28, 2016

slide-34
SLIDE 34

67

Color Spaces

RGB color cube

  • Does not correspond very well to

perception (e.g. distance between two points has little meaning)

68

Color Spaces

HSV color cone

Lightness Hue Colorfulness

02-Color.key - August 28, 2016

slide-35
SLIDE 35

69

Color Spaces

RGB color cube HSV color cone CIE (x,y)

MacAdam Ellipses (10x)

Colors in ellipses indistinguishable from center.

70

Color Spaces

RGB color cube HSV color cone CIE (x,y) CIE (u,v)

Scaled to be closer to circles.

! " # $ % & + + = ! " # $ % & ' ' Y X Z Y X v u 9 4 3 15 1

x,y u,v

02-Color.key - August 28, 2016

slide-36
SLIDE 36

CIELAB Space (AKA L*a*b*)

71

A commonly used color space that strives for perceptual uniformity

  • L* is lightness
  • a* and b* are color-opponent pairs
  • a* is red-green
  • b* is blue-yellow
  • Nonlinear transformation from CIEXYZ to

CIELAB

  • Visual system appears to encode color this

way (opponent color theory)

  • Afterimages
  • No “redish green” or “blueish yellow”

Monitor Intensity and Gamma

  • Monitors convert pixel value into intensity level
  • 0.0 maps to zero intensity = black (well not quite)
  • 1.0 maps to full intensity = white
  • Monitors are not linear
  • 0.5 does not map to “halfway” gray, (e.g. 0.5 might map to 0.217)
  • Nonlinearity characterized by exponential function


where = displayed intensity and = pixel value (between 0 and 1)

  • For many monitors is near 2 (often between 1.8 and 2.2)

72

I = aγ I a

γ

02-Color.key - August 28, 2016

slide-37
SLIDE 37

Determining Gamma

  • Suppose I know displayed intensity of a patch
  • Let viewer adjust pixel value of nearby patch until match
  • How do we make a patch of known intensity?

73

I = aγ

I = 0.5 0.5 = aγ a γ = ln 0.5 ln a

Patch of known

I = 0.5

Viewer adjusts pixel values until this 
 patch visually matches

a

Determining Gamma

http://www.cs.cornell.edu/Courses/cs4620/2008fa/homeworks/gamma.htm

74

02-Color.key - August 28, 2016

slide-38
SLIDE 38

75

Dynamic Range

Surface of the sun 2,000,000,000 nits Sunlight clouds 30,000 Clear sky 3,000 Cellphone display 500 Overcast sky 300 Scene at sunrise 30 Scene lit by moon 0.001 Threshold of vision 0.000001

1nit = 1 candela / m^2

76

Dynamic Range

  • Max/min values also limited on devices
  • “blackest black”
  • “brightest white”

Jack Tumblin

02-Color.key - August 28, 2016

slide-39
SLIDE 39

Fake High Dynamic Range

77 78

Tone Mapping

Kirk and O’Brien 2011

02-Color.key - August 28, 2016

slide-40
SLIDE 40

Rods Contribute to Color

OR/G=M-L + fR/G (L,M,R) OB/Y=S-(L+M) + fB/Y (L,M,S,R) OL =L+M + fL (L,M,R) OL OB/Y OR/G L M S R

80

Color Phenomena

  • Light sources seldom shine directly in eye
  • Light follows some transport path, i.e.:
  • Source
  • Air
  • Object surface
  • Air
  • Eye
  • Color effected by interactions

02-Color.key - August 28, 2016

slide-41
SLIDE 41

81

Reflection

  • Light strikes object
  • Some frequencies reflect
  • Some adsorbed
  • Reflected spectrum is light times

surface

  • Recall metamers...

Unknown? 82

Transmission

  • Light strikes object
  • Some frequencies pass
  • Some adsorbed (or reflected)

Unknown?

02-Color.key - August 28, 2016

slide-42
SLIDE 42

83

Scattering

  • Interactions with small particles in

medium

  • Long wavelengths ignore
  • Short ones scatter

Unknown? 84

Interference

  • Wave behavior of light
  • Cancelation
  • Reinforcement
  • Wavelength dependent

Unknown?

02-Color.key - August 28, 2016

slide-43
SLIDE 43

85

Iridescence

  • Interaction of light with
  • Small structures
  • Thin transparent surfaces

Unknown? 86

Iridescence

02-Color.key - August 28, 2016

slide-44
SLIDE 44

87

Iridescence

88

Fluorescence / Phosphorescence

  • Photon come in, knocks up electron
  • Electron drops and emits photon at other frequency
  • May be some latency
  • Radio active decay can also emit visible photons

02-Color.key - August 28, 2016

slide-45
SLIDE 45

89

Fluorescence / Phosphorescence

90

Black Body Radiation

  • Hot objects radiate energy
  • Frequency is temperature dependent
  • Moderately hot objects get into visible range
  • Spectral distribution is given by
  • Leads to notion of “color temperature”

E λ

( ) ∝

1 λ5 $ % & ' 1 exp hc kλT

( )−1

$ % ) & ' * 02-Color.key - August 28, 2016

slide-46
SLIDE 46

91

Black Body Radiation

HyperPhysics

02-Color.key - August 28, 2016