© Michal Havlik - Carnegie Mellon Computer...

54
Modeling Light 15-463: Computational Photography Alexei Efros, CMU, Fall 2007 © Michal Havlik

Transcript of © Michal Havlik - Carnegie Mellon Computer...

Page 1: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Modeling Light

15-463: Computational PhotographyAlexei Efros, CMU, Fall 2007

© Michal Havlik

Page 2: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

What is light?Electromagnetic radiation (EMR) moving along rays in

space• R(λ) is EMR, measured in units of power (watts)

– λ

is wavelength

Useful things:• Light travels in straight lines• In vacuum, radiance emitted = radiance arriving

• i.e. there is no transmission loss

Page 3: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Point of observation

Figures © Stephen E. Palmer, 2002

What do we see?

3D world 2D image

Page 4: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

What do we see?

3D world 2D image

Painted backdrop

Page 5: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

On Simulating the Visual ExperienceJust feed the eyes the right data

• No one will know the difference!

Philosophy:• Ancient question: “Does the world really exist?”

Science fiction:• Many, many, many books on the subject, e.g. slowglass• Latest take: The Matrix

Physics:• Slowglass might be possible?

Computer Science:• Virtual Reality

To simulate we need to know:What does a person see?

Page 6: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

The Plenoptic Function

Q: What is the set of all things that we can ever see?A: The Plenoptic Function (Adelson & Bergen)

Let’s start with a stationary person and try to parameterize everything that he can see…

Figure by Leonard McMillan

Page 7: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Grayscale snapshot

is intensity of light • Seen from a single view point• At a single time• Averaged over the wavelengths of the visible spectrum

(can also do P(x,y), but spherical coordinate are nicer)

P(θ,φ)

Page 8: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Color snapshot

is intensity of light • Seen from a single view point• At a single time• As a function of wavelength

P(θ,φ,λ)

Page 9: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

A movie

is intensity of light • Seen from a single view point• Over time• As a function of wavelength

P(θ,φ,λ,t)

Page 10: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Holographic movie

is intensity of light • Seen from ANY viewpoint• Over time• As a function of wavelength

P(θ,φ,λ,t,VX ,VY ,VZ )

Page 11: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

The Plenoptic Function

• Can reconstruct every possible view, at every moment, from every position, at every wavelength

• Contains every photograph, every movie, everything that anyone has ever seen! it completely captures our visual reality! Not bad for a function…

P(θ,φ,λ,t,VX ,VY ,VZ )

Page 12: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Sampling Plenoptic Function (top view)

Just lookup -- Quicktime VR

Page 13: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

RayLet’s not worry about time and color:

5D• 3D position• 2D direction

P(θ,φ,VX ,VY ,VZ )

Slide by Rick Szeliski and Michael Cohen

Page 14: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Surface Camera

No Change in 

Radiance

Lighting

How can we use this?

Page 15: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Ray ReuseInfinite line

• Assume light is constant (vacuum)

4D• 2D direction• 2D position• non-dispersive medium

Slide by Rick Szeliski and Michael Cohen

Page 16: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Only need plenoptic surface

Page 17: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Synthesizing novel views

Slide by Rick Szeliski and Michael Cohen

Page 18: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph / LightfieldOutside convex space

4D StuffEmpty

Slide by Rick Szeliski and Michael Cohen

Page 19: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph - Organization 2D position2D direction

Slide by Rick Szeliski and Michael Cohen

Page 20: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph - Organization

2D position2D position

2 plane parameterization

su

Slide by Rick Szeliski and Michael Cohen

Page 21: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph - Organization

2D position2D position

2 plane parameterization

us

t s,tu,v

v

s,t

u,v

Slide by Rick Szeliski and Michael Cohen

Page 22: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph - Organization

Hold s,t

constantLet u,v

vary

An image

s,t u,vSlide by Rick Szeliski and Michael Cohen

Page 23: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph / Lightfield

Page 24: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph - Capture

Idea 1• Move camera carefully over s,t

plane• Gantry

– see Lightfield paper

s,t u,vSlide by Rick Szeliski and Michael Cohen

Page 25: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph - Capture

Idea 2• Move camera anywhere• Rebinning

– see Lumigraph paper

s,t u,vSlide by Rick Szeliski and Michael Cohen

Page 26: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph - Rendering

For each output pixel• determine s,t,u,v

• either• use closest discrete RGB• interpolate near values s u

Slide by Rick Szeliski and Michael Cohen

Page 27: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lumigraph - Rendering

Nearest• closest s• closest u• draw it

Blend 16 nearest• quadrilinear interpolation

s uSlide by Rick Szeliski and Michael Cohen

Page 28: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Stanford multi-camera array

640 ×

480 pixels × 30 fps ×

128 cameras

synchronized timing•

continuous streaming

flexible arrangement

Page 29: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Light field photography using a handheld plenoptic

camera

Ren Ng, Marc Levoy, Mathieu Brédif,Gene Duval, Mark Horowitz and Pat Hanrahan

Page 30: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

© 2005 Marc Levoy

Conventional versus light field camera

Page 31: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

© 2005 Marc Levoy

Conventional versus light field camera

uv-plane st-plane

Page 32: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Prototype camera

4000 × 4000 pixels ÷ 292 × 292 lenses = 14 × 14 pixels per lens

Contax

medium format camera Kodak 16-megapixel sensor

Adaptive Optics microlens

array 125μ

square-sided microlenses

Page 33: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole
Page 34: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

© 2005 Marc Levoy

Digitally stopping-down

stopping down = summing only the central portion of each microlens

Σ

Σ

Page 35: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

© 2005 Marc Levoy

Digital refocusing

refocusing = summing windows extracted from several microlenses

Σ

Σ

Page 36: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

© 2005 Marc Levoy

Example of digital refocusing

Page 37: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

© 2005 Marc Levoy

Digitally moving the observer

moving the observer = moving the window we extract from the microlenses

Σ

Σ

Page 38: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

© 2005 Marc Levoy

Example of moving the observer

Page 39: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

© 2005 Marc Levoy

Moving backward and forward

Page 40: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

3D LumigraphOne row of s,t plane

• i.e., hold t constant

s,t u,v

Page 41: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

3D LumigraphOne row of s,t plane

• i.e., hold t constant• thus s,u,v• a “row of images”

s

u,v

Page 42: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

by David DeweyP(x,t)

Page 43: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

2D: ImageWhat is an image?

All rays through a point• Panorama?

Slide by Rick Szeliski and Michael Cohen

Page 44: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

ImageImage plane

2D• position

Page 45: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Spherical Panorama

All light rays through a point form a ponoramaTotally captured in a 2D array -- P(θ,φ)Where is the geometry???

See also: 2003 New Years Evehttp://www.panoramas.dk/fullscreen3/f1.html

Page 46: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Other ways to sample Plenoptic FunctionMoving in time:

• Spatio-temporal volume: P(θ,φ,t)• Useful to study temporal changes• Long an interest of artists:

Claude Monet, Haystacks studies

Page 47: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Space-time images

Other ways to slice theplenoptic function…

x

y

t

Page 48: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

The “Theatre Workshop” Metaphor

desired image

(Adelson & Pentland,1996)

Painter Lighting Designer Sheet-metalworker

Page 50: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Lighting Designer (environment maps)

Show Naimark SF MOMA videohttp://www.debevec.org/Naimark/naimark-displacements.mov

Page 51: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Sheet-metal Worker (geometry)

Let surface normals do all the work!

Page 52: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

… working together

Want to minimize costEach one does what’s easiest for him

• Geometry – big things• Images – detail• Lighting – illumination effects

clever Italians

Page 53: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Midterm next Tuesday• 80 minutes long (come on time!)• Closed book, closed notes, closed laptops• But can have a cheat sheet (1 page, both

sides)

• Will cover all material up to this week!

Page 54: © Michal Havlik - Carnegie Mellon Computer Graphicsgraphics.cs.cmu.edu/courses/15-463/2007_fall/Lectures… ·  · 2007-12-12Computer Science: • Virtual Reality. ... • Pin-hole

Midterm Review• Cameras

• Pin-hole model, camera “knobs”, perspective projection, orthographic (parallel) projection, etc.

• Capturing & modeling Light• Physics of Light, light perception, color, The Plenoptic function,

Lumigraph/Lightfields

• Image Processing• Point processing, histograms, filtering, correlation, convolution, 2D

Fourier transform, low-pass/band-pass/high-pass filtering, edge detection, Gaussian and laplacian pyramids, blending, etc.

• Image Warping and Morphing• 2D parametric transformations, homogeneous coordinates,

degrees of freedom, difference between affine and projective transformations, forward/inverse warping, morphing, etc.

• Data-driven Methods• Markov Chains, using data to model the world, face modeling with

basis, video and texture synthesis