Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a...

75
Computational Photography and Capture: Rendering a Scene from a Single Photograph Gabriel Brostow & Tim Weyrich TAs: Clément Godard & Fabrizio Pece

Transcript of Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a...

Page 1: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Computational Photography and Capture:

Rendering a Scene from a Single Photograph

Gabriel Brostow & Tim Weyrich

TAs: Clément Godard & Fabrizio Pece

Page 2: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Breaking Out of 2D

But must we go to full 3D? 4D?

Page 3: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

First, what is IBR?(Image Based Rendering)

“View Interpolation for Image Synthesis”

• By Shenchang E. Chen & Lance Williams, SIGGRAPH 1993

• Complexity independent

• Fast

• 2 Types of IBR:

• With geometric models

• Without models (if pixels don’t count)

Page 4: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Available Radiance Samples

• (R, G, B) at each (x, y, z)

• Synthetic: Obtained from World-space of 3D models

• Real: Obtained by computer vision “innovations”

Page 5: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Rotating to the right…

Page 6: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Using additional source images

From 1 source I From 2 source I’s From 2 source I’s

(closely spaced)

From 2 source I’s

(Interpolated)

Page 7: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Model Implementation

• Make morph maps between all nodes

I(B)I(A)

I(C)

MAB

MAC

MAB-2, 1, -3

Page 8: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Interpolation

Forward Mapping:

• Neighboring pixels (old way)

Backward Mapping:

• 3D Spatial-offset vectors:– pure parametric OR

– range-specific

“offset vector indicates the amount each of the pixels moves in its screen space as a result of the camera’s movement”

Page 9: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Faster!

• Quadtrees:

– When depth changes a lot incr. resolution

– When depth is smooth, pixels move together

• Speedups ARE complexity dependant

• Incremental rendering

Page 10: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Cool Byproducts: Motion Blur

Real View-Interpolation Result

Page 11: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Cool Byproducts

• Shadows

• Specular reflections(requires separate maps)

• Current:

– Image-based primitives

Page 12: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Plenoptic Function: Light Fields

• Light Field Rendering. Levoy and Hanrahan, Siggraph 1996

• The Lumigraph: Gortler et al. Siggraph 1996

data link

Page 13: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Stanford Light-Field Capture(All photos are from http://lightfield.stanford.edu/acq.html)

Page 14: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Stanford Light-Field Capture(All photos are from http://lightfield.stanford.edu/acq.html)

Page 15: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Tour Into the PictureHorry, Anjyo, Arai, SIGGRAPH 1997

Slides borrowed from Alexei Efros,

who built on Steve Seitz’s and David Brogan’s

Page 16: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

We want more of the plenoptic function

We want real 3D scene

walk-throughs:Camera rotation

Camera translation

Can we do it from a single photograph?

3D in the Real World

Page 17: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Camera rotations with homographies

St.Petersburg

photo by A. Tikhonov

Virtual camera rotations

Original image

Page 18: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Camera translation• Does it work? synthetic PP

PP1

PP2

Page 19: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

So, what can we do here?

• Model the scene as a set of planes!

• Now, just need to find the orientations of these planes.

Page 20: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Remember Preliminaries: Projective Geometry

Ames Room

Page 21: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Silly Euclid!

Parallel lines converge?

Page 22: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Vanishing lines

• Multiple Vanishing Points

– Any set of parallel lines on the plane define a vanishing point

– The union of all of these vanishing points is the horizon line• also called vanishing line

– Note that different planes define different vanishing lines

v1 v2

Page 23: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Vanishing lines

• Multiple Vanishing Points

– Any set of parallel lines on the plane define a vanishing point

– The union of all of these vanishing points is the horizon line• also called vanishing line

– Note that different planes define different vanishing lines

Page 24: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Computing vanishing lines

• Properties– l is intersection of horizontal plane through C with image plane

– Compute l from two sets of parallel lines on ground plane

– All points at same height as C project to l

• points higher than C project above l

– Provides way of comparing height of objects in the scene

ground plane

lC

Page 25: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the
Page 26: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

2 Point Perspective Street Scene http://cutlerart73.com/assign4.html

Page 27: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

2 Point Perspective Street Scene http://cutlerart73.com/assign4.html

“ 3 Point Perspective At Play”

http://artintegrity.wordpress.com/2008/05/26/24-trouble-with-perspective-in-drawing-this-may-help/

“Ascending and Descending”http://www.mcescher.com/Biography/lw435f2.jpg

Page 28: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

See Also: Single View Metrology

A. Criminisi, I. Reid and A. Zisserman, ICCV1999

1.Pick a reference plane2.Pick a reference direction

Figure 6: Measuring heights using parallel lines: Given i) the vertical vanishing point, ii)the vanishing line for the ground plane and iii) a reference height, then the distance of the top of the window on the right wall from the ground plane is measured from the distance between the two horizontal lines shown, one defined by the top edge of the window, and the other on the ground plane.

Page 29: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

“Tour into the Picture,” Horry et al. 1997

• Create a 3D “theatre stage” of five billboards

• Specify foreground objects through bounding polygons

• Use camera transformations to navigate through the scene

Page 30: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

The idea

• Many scenes (especially paintings), can be represented as an axis-aligned box volume (i.e. a stage)

• Key assumptions:

– All walls of volume are orthogonal

– Camera view plane is parallel to back of volume

– Camera up is normal to volume bottom

• How many vanishing points does the box have?

– Three, but two at infinity

– Single-point perspective

• Can use the vanishing point

to fit the box to the particular

scene!

Page 31: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Fitting the box volume

• User controls the inner box and the vanishing point placement (# of DOF???)

• Q: What’s the significance of the vanishing point location?

• A: It’s at eye level: ray from COP to VP is perpendicular to image plane.

Page 32: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

DEMO

• Now, we know the 3D geometry of the box

• We can texture-map the box walls with texture from the image

link to web page with example code

Page 33: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

High

Camera

Example of user input: vanishing point and back face of

view volume are defined

Page 34: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Low

Camera

Example of user input: vanishing point and back face of

view volume are defined

Page 35: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

High Camera Low Camera

Comparison of how image is subdivided based on two

different camera positions. You should see how moving

the vanishing point corresponds to moving the eyepoint in

the 3D world.

Page 36: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Left

Camera

Another example of user input: vanishing point and back

face of view volume are defined

Page 37: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Right

Camera

Another example of user input: vanishing point and back

face of view volume are defined

Page 38: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Left Camera Right Camera

Comparison of two camera placements – left and right.

Corresponding subdivisions match view you would see if

you looked down a hallway.

Page 39: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

2D to 3D conversion

• First, we can get ratios

left right

top

bottom

vanishing

point

back

plane

Page 40: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

• Size of user-defined back plane must equal

size of camera plane (orthogonal sides)

• Use top versus side ratio

to determine relative

height and width

dimensions of box

• Left/right and top/bot

ratios determine part of

3D camera placement

left right

top

bottomcamera

pos

2D to 3D conversion

Page 41: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Foreground Objects•Use separate billboard for each

•For this to work, three separate images used:

– Original image.

– Mask to isolate desired foreground images.

– Background with objects removed

Page 42: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Foreground Objects

• Add vertical rectangles for each foreground object

• Can compute 3D coordinates P0, P1 since they are on known plane.

• P2, P3 can be computed as before (similar triangles)

Page 43: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Foreground

TIP movie

UVA example

Page 45: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Automatic Photo Pop-upHoiem, Efros, Hebert,

SIGGRAPH 2005<project page>

(using Derek Hoiem’s slides)

Page 46: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Related Work

• Multiple Images– Manual Reconstruction

• Façade [Debevec et al. 1996], REALVIZ Image Modeler,

• Photobuilder [Cipolla et al. 1999], [Zieglier et al. 2003], etc.

– Automatic Reconstruction• Structure from Motion (e.g. [Nister 2001], [Pollefeys et al. 2004])

• Single Image– Manual Reconstruction

• Metric ([Liebowitz et al. 1999], [Criminisi et al. 1999])

• Approximate: Tour into the Picture [Horry et al. 1997];

[Kang et al. 2001], [Oh et al. 2001], [Zhang et al. 2001], etc.

– Automatic Reconstruction..?

Page 47: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

The Problem

from [Sinha and Adelson 1993]

• Recovering 3D geometry from single 2D projection

• Infinite number of possible solutions!

Page 48: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Goals

• Simple, piecewise planar models

• Outdoor scenes

• Doesn’t need to work all the time (~35%)

Pop-up Book

Page 49: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Approach: Learn Correlation

• Learn structure of the world and appearance-based models of geometry

Page 50: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Overview

Input

Ground

Vertical

Sky

Geometric Labels Cut’n’Fold 3D Model

Image

Learned Models

Page 51: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Cues

Color

Location

Texture

Perspective

Page 52: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Need Spatial Support

50x50 Patch50x50 Patch

Color Texture PerspectiveColor Texture Perspective

Page 53: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Robust Spatial Support

RGB Pixels Superpixels

[Felzenszwalb and

Huttenlocher 2004]

Somewhat unpredictable!

Page 54: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Grouping Superpixels

• Simple color, texture, location cues

• Which superpixels come from the same surface?

• Learn from training images– Boosted kernel density estimation

Page 55: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Many Weak Geometric Cues

• Material

• Image Location

• 3D Geometry

Page 56: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Multiple Segmentations

Superpixels

Multiple

Segmentations

• Group superpixels likely to be from the same surface into segments

• Single segmentation unreliable

• Create multiple segmentations

Page 57: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Learning Appearance-based Geometry

• All geometric cues available

• Does this segment correspond to a single surface? (homogeneity likelihood)

• If so, what is the geometry of that surface? (label likelihood)

Page 58: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Learn from training images

• Prepare training images– Create multiple segmentations of training images

– Get segment labels from ground truth – ground, vertical, sky, or “mixed”

• Density estimation by boosted decision trees– 8 nodes per tree

– Logistic regression version of Adaboost

• See [Collins and Schapire and Singer 2002]

Label LikelihoodHomogeneity Likelihood

Page 59: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Labeling Segments

For each segment:

- Get

Page 60: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Image Labeling

Labeled Segmentations

Labeled Pixels

Learned from

training images

Page 61: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Cutting and Folding

• Fit ground-vertical boundary

– Iterative Hough transform

Page 62: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Cutting and Folding

• Form polylines from boundary segments– Join segments that intersect at slight angles

– Remove small overlapping polylines

• Estimate horizon position from perspective cues

Page 63: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Cutting and Folding

• ``Fold’’ along polylines and at corners

• ``Cut’’ at ends of polylines and along vertical-sky boundary

Page 64: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Results

Input Image

Automatic Photo Pop-upCut and Fold

Page 65: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Results

Automatic Photo Pop-up

Input Image

Cut and Fold

Page 66: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Results

Automatic Photo Pop-upInput Image

Page 67: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Results

Automatic Photo Pop-upInput Images

Page 68: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Results

Automatic Photo Pop-upInput Image

Page 69: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Comparison with Manual Method

Input Image

Automatic Photo Pop-up (30 sec)!

[Liebowitz et al. 1999]

Page 70: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Failures

Labeling Errors

Page 71: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

FailuresForeground Objects

See Music Video

Page 72: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Just the first step…

• Richer set of geometric classes (ICCV 05 paper)

• Segment foreground objects

• Cleaner segmentation

• More accurate labeling

Average: 86%

Quantitative Results (ICCV 05)

Page 73: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

Photo Pop-up Conclusions

• First system to automatically recover 3D scene from single image!

• Learn statistics of our world from training images

See also their journal version:“Recovering Surface Layout from an Image,“

IJCV 2007

Page 74: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

See Also (and compare)

• Make3D

– http://make3d.stanford.edu/

– Includes source code!

– “Make3D: Learning 3-D Scene Structure from a Single Still Image”, Saxena, Sun, Ng, PAMI 2008

Page 75: Computational Photography and Capture: Rendering a Scene ... · 1.Pick a reference plane 2.Pick a reference direction Figure 6: Measuring heights using parallel lines: Given i) the

See Also: Image-Based Modelingand Photo Editing

Oh et al., SIGGRAPH 2001

WebVideo (loud)