Administrivia Assignment 2 available now - back to programming - - - PowerPoint PPT Presentation

administrivia
SMART_READER_LITE
LIVE PREVIEW

Administrivia Assignment 2 available now - back to programming - - - PowerPoint PPT Presentation

C OMPUTATIONAL A SPECTS OF D IGITAL P HOTOGRAPHY Light & Color (continued) Wojciech Jarosz wojciech.k.jarosz@dartmouth.edu Administrivia Assignment 2 available now - back to programming - due next Wednesday CS 89/189: Computational


slide-1
SLIDE 1

COMPUTATIONAL ASPECTS OF DIGITAL PHOTOGRAPHY

Light & Color (continued)

Wojciech Jarosz

wojciech.k.jarosz@dartmouth.edu

slide-2
SLIDE 2

Administrivia

Assignment 2 available now

  • back to programming
  • due next Wednesday

CS 89/189: Computational Photography, Fall 2015 2

slide-3
SLIDE 3

Last time…

Light & Color

  • Physics background
  • Color perception & measurement
  • Color reproduction
  • Color spaces

CS 89/189: Computational Photography, Fall 2015 3

slide-4
SLIDE 4

CS 89/189: Computational Photography, Fall 2015

What is light?

4

slide-5
SLIDE 5

Spectral distribution function (SPD)

Light can be a mixture of many wavelengths

  • SPD: intensity as a function of wavelength over enter spectrum

CS 89/189: Computational Photography, Fall 2015 5

slide-6
SLIDE 6

× =

Light-matter interaction

CS 89/189: Computational Photography, Fall 2015 6 Foundations of Vision, by Wandell After a slide by Frédo Durand

slide-7
SLIDE 7

Physical light to perceptual color

CS 89/189: Computational Photography, Fall 2015 7 After a slide by Steve Marschner

Physical Perceptual

?

slide-8
SLIDE 8

The eye as a measurement device

CS 89/189: Computational Photography, Fall 2015 8

near fovea away from fovea

slide-9
SLIDE 9

CS 89/189: Computational Photography, Fall 2015

A simple light detector model

9

n(λ) p(λ) X =

Z

n(λ)p(λ) dλ

After a slide by Steve Marschner

slide-10
SLIDE 10

Light detection math

CS 89/189: Computational Photography, Fall 2015 10

X =

Z

s(λ) r(λ) dλ

measured signal input spectrum detector’s sensitivity

After a slide by Steve Marschner

M =

Z

rM(λ) s(λ) dλ S =

Z

rS(λ) s(λ) dλ L =

Z

rL(λ) s(λ) dλ

slide-11
SLIDE 11

Stimulus 
 (arbitrary spectrum) Response curves Multiply Integrate

1 number 1 number 1 number

Start with infinite number of values 
 (one per wavelength) End up with 3 values (one per cone type)

slide-12
SLIDE 12

Linear algebra interpretation

CS 89/189: Computational Photography, Fall 2015 12

Input L M S

After a slide by Matthias Zwicker

slide-13
SLIDE 13

Linear algebra interpretation

CS 89/189: Computational Photography, Fall 2015 13

cone sensitivities Input L M S

After a slide by Matthias Zwicker

slide-14
SLIDE 14

Linear algebra interpretation

CS 89/189: Computational Photography, Fall 2015 14

*

cone sensitivities input spectrum Input L M S

After a slide by Matthias Zwicker

slide-15
SLIDE 15

Tristimulus response is a matrix-vector multiplication

Linear algebra interpretation

CS 89/189: Computational Photography, Fall 2015 15

*

cone sensitivities input spectrum tristimulus
 response

=

Input L M S

After a slide by Matthias Zwicker

slide-16
SLIDE 16

Cone responses to a spectrum s

rS, rM and rL are N-dimensional vectors, where N ¡= ¡∞

CS 89/189: Computational Photography, Fall 2015 16

M =

Z

rM(λ) s(λ) dλ = rM · s S =

Z

rS(λ) s(λ) dλ = rS · s L =

Z

rL(λ) s(λ) dλ = rL · s   S M L   =   rS rM rL    

|

s

|

  Integral notation: Matrix notation:

slide-17
SLIDE 17

Physical light to perceptual color

CS 89/189: Computational Photography, Fall 2015 17 After a slide by Steve Marschner

Physical Perceptual   S M L   =   rS rM rL    

|

s

|

 

slide-18
SLIDE 18

Basic fact of colorimetry

Take a spectrum (which is an infinity of numbers) Eye produces three numbers (a projection to 3D) This throws away a lot of information!

  • many spectra can produce same S, M, L tristimulus values!
  • metamers
  • affected by illuminant

CS 89/189: Computational Photography, Fall 2015 18 After a slide by Steve Marschner

slide-19
SLIDE 19

Warning: tricky thing with color

Cone responses overlap & are not orthogonal! Basis functions for analysis

  • eyes, cameras

are different than for synthesis

  • lights, monitors

The RGB in your camera is different than
 the RGB in your monitor!

CS 89/189: Computational Photography, Fall 2015 19 After a slide by Frédo Durand

slide-20
SLIDE 20

We want to compute the combination of R, G, B that will project to the same visual response as s

Color reproduction (the right way)

CS 89/189: Computational Photography, Fall 2015 20 After a slide by Steve Marschner

slide-21
SLIDE 21

What color do we see when we look at the display?

  • Feed C to display

Color reproduction as linear algebra

CS 89/189: Computational Photography, Fall 2015 21

B C

After a slide by Steve Marschner

slide-22
SLIDE 22

What color do we see when we look at the display?

  • Feed C to display
  • Display produces sa

Color reproduction as linear algebra

CS 89/189: Computational Photography, Fall 2015 22

L MRGB C

After a slide by Steve Marschner

slide-23
SLIDE 23

What color do we see when we look at the display?

  • Feed C to display
  • Display produces sa
  • Eye looks at sa and produces E

Color reproduction as linear algebra

CS 89/189: Computational Photography, Fall 2015 23

  S M L   =   rS · sR rS · sG rS · sB rM · sR rM · sG rM · sB rL · sR rL · sG rL · sB     R G B   E = MSML MRGB C

After a slide by Steve Marschner

slide-24
SLIDE 24

Goal of reproduction: visual response to s and sa is the same: Substitute in expression for sa ¡,

Color reproduction as linear algebra

CS 89/189: Computational Photography, Fall 2015 24

MSML s = MSML sa MSML s = MSML MRGB C C = (MSML MRGB)−1MSML s

color matching matrix for RGB

After a slide by Steve Marschner

slide-25
SLIDE 25

Meaning of these curves/rows

Monochromatic wavelength λ can be reproduced with:
 b(λ) amount of the 435.8nm primary,
 + ¡g(λ) amount of the 546.1 primary,
 + ¡r(λ) amount of the 700 nm primary

CS 89/189: Computational Photography, Fall 2015 25

Negative light required?

slide-26
SLIDE 26

CIE XYZ color space

Linear algebra to the rescue! Purely positive basis functions Linear transformation of CIE RGB Non-physical primaries

CS 89/189: Computational Photography, Fall 2015 26

CIE RGB CIE XYZ

  X Y Z   = 1 0.17697   0.49 0.31 0.20 0.17697 0.81240 0.01063 0.00 0.01 0.99     R G B  

slide-27
SLIDE 27

CIE XYZ color cone

3D spaces can be hard to visualize Chrominance is our notion of color, as opposed to brightness/luminance Recall that our eyes correct for
 multiplicative scale factors

  • discount light intensity

CS 89/189: Computational Photography, Fall 2015 27

slide-28
SLIDE 28

Chromaticity Diagram

slide-29
SLIDE 29

The CIE xyY Color Space

Chromaticity (x,y) can be derived by normalizing the XYZ color components:

  • (x,y) characterize color
  • Y characterizes brightness

Combining xy with Y allows us to represent any color Plotting on xy plane allows us to see all colors of a single brightness

CS 89/189: Computational Photography, Fall 2015 29

x = X X + Y + Z y = Y X + Y + Z

slide-30
SLIDE 30

CIE Chromaticity Chart

Spectral colors along curved boundary Linear combination of two colors: line connecting two points Linear combination of 3 colors span a triangle (color gamut)

CS 89/189: Computational Photography, Fall 2015 30

slide-31
SLIDE 31

CIE RGB Color Space

Color primaries at:
 435.8, 546.1, 700.0 nm

CS 89/189: Computational Photography, Fall 2015 31

slide-32
SLIDE 32

Color Gamuts

CS 89/189: Computational Photography, Fall 2015 32

values ce ut

slide-33
SLIDE 33

CIE Chromaticity Chart Features

White Point Dominant wavelength Inverse color

CS 89/189: Computational Photography, Fall 2015 33

A A’ B

slide-34
SLIDE 34

Perceptually-Uniform Color Spaces

All these color spaces so far are perceptually non- uniform:

  • two colors close together in space are not necessarily

visually similar

  • two colors far apart are not necessarily very different!

Measuring “perceptual distance” in color spaces important for many industries Experiments by MacAdams

CS 89/189: Computational Photography, Fall 2015 34

slide-35
SLIDE 35

MacAdams Color Ellipses

CS 89/189: Computational Photography, Fall 2015 35

Test patches

slide-36
SLIDE 36

CIELab and CIELuv Color Spaces

Two attempts to make a perceptually-uniform color space MacAdams ellipses become nearly (but not perfectly) circular

CS 89/189: Computational Photography, Fall 2015 36

slide-37
SLIDE 37

Higher-level color perception

slide-38
SLIDE 38

Higher-level color perception

Color perception is much more complicated than response of SML cones… Visual pathway

  • A lot happens after the cones
  • But: cone responses are input to further processing

CS 89/189: Computational Photography, Fall 2015 38

slide-39
SLIDE 39

Color constancy

Also known as chromatic adaptation Color of object is perceived as the same even under varying illumination For example:

  • A white sheet of paper under green illumination is still

perceived as white, even though the reflected light is green! The human brain infers the white color from the context, which is “green-ish“ too because of the green illumination.

CS 89/189: Computational Photography, Fall 2015 39

slide-40
SLIDE 40

CS 89/189: Computational Photography, Fall 2015

Color constancy

40

slide-41
SLIDE 41

blue and black?

  • r

white and gold?

slide-42
SLIDE 42

Color constancy failure

http://xkcd.com/1492/

slide-43
SLIDE 43

Hering’s opponent process theory (1874)

After sensing by cones, colors are encoded as red versus green, blue versus yellow, and black versus white Physiological evidence found in the 1950s

CS 89/189: Computational Photography, Fall 2015 43

+

  • Red/Green


Receptors Blue/Yellow
 Receptors Black/White
 Receptors

+

  • +
slide-44
SLIDE 44

Dual process theory

Inputs are LMS cone responses Output has a different parameterization:

  • Light-dark
  • Blue-yellow
  • Red-green

CS 89/189: Computational Photography, Fall 2015 44 Bk G Y Wh B R S L M

Trichromatic Stage Opponent-Process Stage

slide-45
SLIDE 45

Color opponents wiring

CS 89/189: Computational Photography, Fall 2015 45

Sums for brightness Differences for color

  • pponents

At the end, it’s just a 3x3 matrix compared to LMS

slide-46
SLIDE 46
slide-47
SLIDE 47
slide-48
SLIDE 48

Image Afterimage

Opponent Colors

slide-49
SLIDE 49
slide-50
SLIDE 50
slide-51
SLIDE 51
slide-52
SLIDE 52
slide-53
SLIDE 53
slide-54
SLIDE 54
slide-55
SLIDE 55

Opponent color spaces

Luminance, red-green, blue-yellow CIELab YUV YcrCb

  • used a lot in image/video compression

CS 89/189: Computational Photography, Fall 2015 55

YUV YCrCb

  Y0 U V   =   0.299 0.587 0.114

0.14713 0.28886

0.436 0.615

0.51499 0.10001

    R G B     R G B   =   1 1.13983 1

0.39465 0.58060

1 2.03211     Y0 U V  

Y0 = 0 + (0.299

·R0

D) + (0.587

·G0

D) + (0.114

·B0

D)

CB = 128 (0.168736 ·R0

D) (0.331264 ·G0 D) + (0.5

·B0

D)

CR = 128 + (0.5

·R0

D) (0.418688 ·G0 D) (0.081312 ·B0 D)

slide-56
SLIDE 56

Programming Assignment 2

Gamma Colorspaces

  • color2gray
  • luminance—chrominance

separation

  • luminance-only brightness/

contrast

  • RGB⇆YUV

Spanish castle illusion Grayworld whitebalance Histograms

  • autolevels
  • visualize RGB histogram
  • histogram equalization &

histogram matching

CS 89/189: Computational Photography, Fall 2015 56

slide-57
SLIDE 57
slide-58
SLIDE 58

Slide credits

Frédo Durand Steve Marschner Matthias Zwicker

CS 89/189: Computational Photography, Fall 2015 58