computational photography lecture 13 – hdr cs 590 spring 2014 prof. alex berg (credits to many...

73
Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Upload: patrick-blake

Post on 22-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Computational Photographylecture 13 – HDR

CS 590 Spring 2014

Prof. Alex Berg

(Credits to many other folks on individual slides)

Page 2: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Assignment 3

Light probes and high dynamic range.

Today

Page 3: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

• Slides from Derek Hoiem and other

Page 4: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

How to render an object inserted into an image?

Page 5: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

How to render an object inserted into an image?

Traditional graphics way• Manually model BRDFs of all room surfaces• Manually model radiance of lights• Do ray tracing to relight object, shadows, etc.

Page 6: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

How to render an object inserted into an image?

Image-based lighting• Capture incoming light with a

“light probe”• Model local scene• Ray trace, but replace distant

scene with info from light probe

Debevec SIGGRAPH 1998

Page 7: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Key ideas for Image-based Lighting• Environment maps: tell what light is entering

at each angle within some shell

+

Page 8: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Cubic Map Example

Page 9: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Spherical Map Example

Page 10: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Key ideas for Image-based Lighting• Light probes: a way of capturing environment

maps in real scenes

Page 11: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)
Page 12: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Mirror ball -> equirectangular

Page 13: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Mirror ball

Equirectangular

Normals Reflection vectors

Phi/theta of reflection vecs

Phi/theta equirectangular domain

Mirror ball -> equirectangular

Page 14: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

One small snag• How do we deal with light sources? Sun, lights, etc?

– They are much, much brighter than the rest of the environment

• Use High Dynamic Range photography!

1

46

1907

15116

18

.

..

.

.Relative

Brightness

Page 15: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Key ideas for Image-based Lighting• Capturing HDR images: needed so that light

probes capture full range of radiance

Page 16: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Problem: Dynamic RangeProblem: Dynamic Range

Page 17: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Long ExposureLong Exposure

10-6 106

10-6 106

Real world

Picture

0 to 255

High dynamic range

Page 18: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Short ExposureShort Exposure

10-6 106

10-6 106

Real world

Picture

High dynamic range

0 to 255

Page 19: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

LDR->HDR by merging exposuresLDR->HDR by merging exposures

10-6 106

Real world

High dynamic range

0 to 255

Exposure 1

…Exposure 2

Exposure n

Page 20: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Ways to vary exposureWays to vary exposure Shutter Speed (*)

F/stop (aperture, iris)

Neutral Density (ND) Filters

Shutter Speed (*)

F/stop (aperture, iris)

Neutral Density (ND) Filters

Page 21: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Shutter SpeedShutter Speed

Ranges: Canon EOS-1D X: 30 to 1/8,000 sec.

ProCamera for iOS: ~1/10 to 1/2,000 sec.

Pros:• Directly varies the exposure• Usually accurate and repeatable

Issues:• Noise in long exposures

Ranges: Canon EOS-1D X: 30 to 1/8,000 sec.

ProCamera for iOS: ~1/10 to 1/2,000 sec.

Pros:• Directly varies the exposure• Usually accurate and repeatable

Issues:• Noise in long exposures

Page 22: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Recovering High Dynamic RangeRadiance Maps from PhotographsRecovering High Dynamic RangeRadiance Maps from Photographs

Paul DebevecJitendra MalikPaul DebevecJitendra Malik

August 1997August 1997

Computer Science DivisionUniversity of California at Berkeley

Computer Science DivisionUniversity of California at Berkeley

Page 23: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

The Approach• Get pixel values Zij for image with shutter time Δtj (ith

pixel location, jth image)• Exposure is radiance integrated over time:

• Pixel values are non-linearly mapped Eij’s:–

• Rewrite to form a (not so obvious) linear system:

Page 24: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

The objective

Solve for radiance R and mapping g for each of 256 pixel values to minimize:

max

min

Z

Zz

N

i

P

jijjiij zgzwZgtRZw 2

1 1

2 )()()(lnln)(

give pixels near 0 or 255 less weight

known shutter time for image j

radiance at particular pixel site is the same for each image

exposure should smoothly increase as pixel intensity increases

exposure, as a function of pixel value

Page 25: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Matlab Code

Page 26: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Matlab Codefunction [g,lE]=gsolve(Z,B,l,w)

n = 256;A = zeros(size(Z,1)*size(Z,2)+n+1,n+size(Z,1));b = zeros(size(A,1),1);

k = 1; %% Include the data-fitting equationsfor i=1:size(Z,1) for j=1:size(Z,2) wij = w(Z(i,j)+1); A(k,Z(i,j)+1) = wij; A(k,n+i) = -wij; b(k,1) = wij * B(i,j); k=k+1; endend

A(k,129) = 1; %% Fix the curve by setting its middle value to 0k=k+1;

for i=1:n-2 %% Include the smoothness equations A(k,i)=l*w(i+1); A(k,i+1)=-2*l*w(i+1); A(k,i+2)=l*w(i+1); k=k+1;end

x = A\b; %% Solve the system using pseudoinverse

g = x(1:n);lE = x(n+1:size(x,1));

Page 27: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

• 3• 3

• 1• 1 •

2• 2

Dt =1 sec

• 3• 3

• 1• 1 •

2• 2

Dt =1/16 sec

• 3• 3

• 1• 1

• 2• 2

Dt =4 sec

• 3• 3

• 1• 1 •

2• 2

Dt =1/64 sec

IllustrationIllustration

Image seriesImage series

• 3• 3

• 1• 1 •

2• 2

Dt =1/4 sec

Exposure = Radiance ´ DtExposure = Radiance ´ Dtlog Exposure = log Radiance + log Dtlog Exposure = log Radiance + log Dt

Pixel Value Z = f(Exposure)Pixel Value Z = f(Exposure)

Page 28: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Response CurveResponse Curve

ln Exposureln Exposure

Assuming unit radiancefor each pixel

Assuming unit radiancefor each pixel

After adjusting radiances to obtain a smooth response

curve

After adjusting radiances to obtain a smooth response

curve

Pix

el v

alue

Pix

el v

alue

33

11

22

ln Exposureln Exposure

Pix

el v

alue

Pix

el v

alue

Page 29: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Results: Digital CameraResults: Digital Camera

Recovered response curve

log Exposure

Pix

el v

alue

Kodak DCS4601/30 to 30 sec

Page 30: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Reconstructed radiance map

Page 31: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Results: Color FilmResults: Color Film• Kodak Gold ASA 100, PhotoCD• Kodak Gold ASA 100, PhotoCD

Page 32: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Recovered Response CurvesRecovered Response Curves

Red Green

RGBBlue

Page 33: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

How to display HDR?

How to display HDR?

Linearly scaled todisplay device

Page 34: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Global Operator (Reinhart et al)Global Operator (Reinhart et al)

world

worlddisplay L

LL

1

Page 35: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Global Operator ResultsGlobal Operator Results

Page 36: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Darkest 0.1% scaledto display device

Reinhart Operator

Page 37: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Local operatorLocal operator

Page 38: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Acquiring the Light ProbeAcquiring the Light Probe

Page 39: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Assembling the Light ProbeAssembling the Light Probe

Page 40: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Real-World HDR Lighting Environments

Lighting Environments from the Light Probe Image Gallery:http://www.debevec.org/Probes/Lighting Environments from the Light Probe Image Gallery:http://www.debevec.org/Probes/

FunstonBeach

UffiziGallery

EucalyptusGrove

GraceCathedral

Page 41: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Illumination ResultsIllumination Results

Page 42: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Comparison: Radiance map versus single imageComparison: Radiance map versus single image

HDR

LDR

Page 43: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

CG Objects Illuminated by a Traditional CG Light Source

CG Objects Illuminated by a Traditional CG Light Source

Page 44: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Illuminating Objects using Measurements of Real LightIlluminating Objects using Measurements of Real Light

ObjectObject

LightLight

http://radsite.lbl.gov/radiance/http://radsite.lbl.gov/radiance/

Environment assigned “glow”

material property inGreg Ward’s RADIANCE system.

Environment assigned “glow”

material property inGreg Ward’s RADIANCE system.

Page 45: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Paul Debevec. A Tutorial on Image-Based Lighting. IEEE Computer Graphics and Applications, Jan/Feb 2002.Paul Debevec. A Tutorial on Image-Based Lighting. IEEE Computer Graphics and Applications, Jan/Feb 2002.

Page 46: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Rendering with Natural LightRendering with Natural Light

SIGGRAPH 98 Electronic Theater

Page 47: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Movie• http://www.youtube.com/watch?v=EHBgkeXH9lU

Page 48: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Illuminating a Small SceneIlluminating a Small Scene

Page 49: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)
Page 50: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

We can now illuminatesynthetic objects with real light.- Environment map- Light probe- HDR- Ray tracing

How do we add synthetic objects to a real scene?

Page 51: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Real Scene ExampleReal Scene Example

Goal: place synthetic objects on tableGoal: place synthetic objects on table

Page 52: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

real scenereal scene

Modeling the SceneModeling the Scene

light-based modellight-based model

Page 53: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Light Probe / Calibration Grid

Page 54: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

real scenereal scene

Modeling the SceneModeling the Scene

synthetic objectssynthetic objects

light-based modellight-based model

local scenelocal scene

Page 55: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Differential RenderingDifferential Rendering

Local scene w/o objects, illuminated by modelLocal scene w/o objects, illuminated by model

Page 56: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

The Lighting ComputationThe Lighting Computation

synthetic objects(known BRDF)

synthetic objects(known BRDF)

distant scene (light-based, unknown BRDF)distant scene (light-based, unknown BRDF)

local scene(estimated BRDF)

local scene(estimated BRDF)

Page 57: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Rendering into the SceneRendering into the Scene

Background PlateBackground Plate

Page 58: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Rendering into the SceneRendering into the Scene

Objects and Local Scene matched to SceneObjects and Local Scene matched to Scene

Page 59: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Differential Rendering Difference in local sceneDifferential Rendering Difference in local scene

-- ==

Page 60: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Differential RenderingDifferential Rendering

Final ResultFinal Result

Page 61: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

IMAGE-BASED LIGHTING IN FIAT LUXPaul Debevec, Tim Hawkins, Westley Sarokin, H. P. Duiker, Christine Cheng, Tal Garfinkel, Jenny Huang

SIGGRAPH 99 Electronic Theater

Page 62: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Fiat Lux• http://ict.debevec.org/~debevec/FiatLux/movie/• http://ict.debevec.org/~debevec/FiatLux/technology/

Page 63: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)
Page 64: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

HDR Image SeriesHDR Image Series

2 sec2 sec 1/4 sec1/4 sec 1/30 sec1/30 sec

1/250 sec1/250 sec 1/2000 sec1/2000 sec 1/8000 sec1/8000 sec

Page 65: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Light Probe ImagesLight Probe Images

Page 66: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Capturing a Spatially-Varying Lighting EnvironmentCapturing a Spatially-Varying Lighting Environment

Page 67: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

What if we don’t have a light probe?

Insert Relit Face

Zoom in on eye

Environment map from eye

http://www1.cs.columbia.edu/CAVE/projects/world_eye/ -- Nishino Nayar 2004

Page 68: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)
Page 69: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Environment Map from an Eye

Page 70: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Can Tell What You are Looking At

Eye Image:

Computed Retinal Image:

Page 71: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)
Page 72: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Summary• Real scenes have complex

geometries and materials that are difficult to model

• We can use an environment map, captured with a light probe, as a replacement for distance lighting

• We can get an HDR image by combining bracketed shots

• We can relight objects at that position using the environment map

Page 73: Computational Photography lecture 13 – HDR CS 590 Spring 2014 Prof. Alex Berg (Credits to many other folks on individual slides)

Take away

• Read the paper for next class (Tuesday), we will go over the math again

http://www.pauldebevec.com/Research/HDR/debevec-siggraph97.pdf

• Make progress on your assignments