perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/eem 561/icerik/lec02_ct... ·...

58
Perspective projection Albrecht Dürer , Mechanical creation of a perspective image, 1525 Slides Credit: Prof. David Forsyth, Prof. Svetlana Lazebnik

Upload: others

Post on 11-Jul-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Perspective projection

Albrecht Dürer, Mechanical creation of a perspective image, 1525

Slides Credit: Prof. David Forsyth, Prof. Svetlana Lazebnik

Page 2: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Overview of next two lectures

• The pinhole projection model• Qualitative properties

• Perspective projection matrix

• Cameras with lenses• Depth of focus

• Field of view

• Lens aberrations

• Digital cameras• Sensors

• Color

• Artifacts

Page 3: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Let’s design a camera

Idea 1: put a piece of film in front of an object

Do we get a reasonable image?

Slide by Steve Seitz

Page 4: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Pinhole camera

Add a barrier to block off most of the rays

Slide by Steve Seitz

Page 5: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Pinhole camera

• Captures pencil of rays – all rays through a single

point: aperture, center of projection, optical center,

focal point, camera center

• The image is formed on the image plane

Slide by Steve Seitz

Page 6: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Camera obscura

• Latin. camera: chamber

or room,

obscura: darkened

• Basic principle known to

Mozi (470-390 BCE),

Aristotle (384-322 BCE)

• Drawing aid for artists:

described by Leonardo

da Vinci (1452-1519)

Gemma Frisius, 1558

Source: A. Efros

Page 7: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Turning a room into a camera obscura

Abelardo Morell, Camera Obscura Image of Manhattan View Looking South in Large

Room, 1996

http://www.abelardomorell.net/camera_obscura1.html

From Grand Images Through a Tiny Opening, Photo

District News, February 2005

Page 8: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Turning a room into a camera obscura

A. Torralba and W. Freeman, Accidental Pinhole and Pinspeck Cameras, CVPR 2012

Page 9: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Pinhole cameras everywhere

Tree shadow during a solar eclipsephoto credit: Nils van der Burg

http://www.physicstogo.org/index.cfm

Slide by Steve Seitz

Page 10: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Point of observation

Figures © Stephen E. Palmer, 2002

Dimensionality reduction: from 3D to 2D

3D world 2D image

What properties of the world are preserved?• Straight lines, incidence

What properties are not preserved?• Angles, lengths Slide by A. Efros

Page 11: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Single-view Geometry

How tall is this woman?

Which ball is closer?

How high is the camera?

What is the camera

rotation?

What is the focal length of

the camera?

Page 12: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Modeling projection

• To compute the projection P’ of a scene point P, form

the visual ray connecting P to the camera center O and

find where it intersects the image plane

• All scene points that lie on this visual ray have the same

projection in the image

• Are there scene points for which this projection is undefined?

P

O

Page 13: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Modeling projection

f z

P

?O

P’

The coordinate system• The optical center (O) is at the origin

• The image plane is parallel to xy-plane or perpendicular to the z-axis,

which is the optical axis

Projection equations• Derived using similar triangles ),(),,(

z

yf

z

xfzyx

y

Page 14: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Point of observation

Fronto-parallel planes

• What happens to the projection of a pattern

on a plane parallel to the image plane?• All points on that plane are at a fixed depth z

• The pattern gets scaled by a factor of f / z, but angles and

ratios of lengths/areas are preserved

),(),,(z

yf

z

xfzyx

Page 15: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Fronto-parallel planes

• What happens to the projection of a pattern

on a plane parallel to the image plane?• All points on that plane are at a fixed depth z

• The pattern gets scaled by a factor of f / z, but angles and

ratios of lengths/areas are preserved

Jan Vermeer, The Music Lesson, 1662-1665Piero della Francesca, Flagellation of Christ, 1455-1460

Page 16: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

What about non-fronto-parallel planes?

Jan Vermeer, The Music Lesson, 1662-1665Piero della Francesca, Flagellation of Christ, 1455-1460

Page 17: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Projection can be tricky…Slide source: Seitz

Page 18: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Projection can be tricky…Slide source: Seitz

Making of 3D sidewalk art:

http://www.youtube.com/watch?v=3SNYtd0Ayt0

Page 19: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Vanishing points

• All parallel lines converge to a vanishing point

• Each direction in space is associated with its own vanishing point

• Exception: directions parallel to the image plane

Page 20: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Constructing the vanishing point of a line

image plane

cameracenter

line in the scene

vanishing point

Slide by Steve Seitz

Page 21: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Perspective cues

Slide by Steve Seitz

Page 22: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Perspective cues

Slide by Steve Seitz

Page 23: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Perspective cues

Slide by Steve Seitz

Page 24: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Vanishing points and lines

Vanishingpoint

Vanishingline

Vanishingpoint

Vertical vanishingpoint

(at infinity)

Slide from Efros, Photo from Criminisi

Page 25: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Vanishing points and lines

Photo from online Tate collection

Page 26: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Note on estimating vanishing points

Use multiple lines for better accuracy

… but lines will not intersect at exactly the same point in practice

One solution: take mean of intersecting pairs

… bad idea!

Instead, minimize angular differences

Page 27: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Vanishing objects

Page 28: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Vanishing lines of planes

Image source: S. Seitz

How do we construct the vanishing line of a plane?

Page 29: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Vanishing lines of planes

Slide by Steve Seitz

cameracenter

plane in the scene

• Horizon: vanishing line of the ground plane

– All points at the same height as the camera project to the

horizon

– Points higher (resp. lower) than the camera project

above (resp. below) the horizon

– Provides way of comparing height of objects

Page 30: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Comparing heights

Vanishing

Point

Slide by Steve Seitz

Page 31: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Measuring height

1

2

3

4

55.4

2.8

3.3

Camera height

What is the height of the camera?

Slide by Steve Seitz

Page 32: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Perspective distortion

• Are the widths of the projected columns equal?• The exterior columns are wider

• This is not an optical illusion, and is not due to lens flaws

• Phenomenon pointed out by Da Vinci

Source: F. Durand

Page 33: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Perspective distortion

• What is the shape of the projection of a sphere?

Image source: F. Durand

Page 34: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Perspective distortion

• What is the shape of the projection of a sphere?

Page 35: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Perspective distortion: People

Page 36: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Some Applications

• Various applications of perspective geometry

& vanishing points

• Credits: David Forsyth & Derek Hoiem

Page 37: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Inverse Perspective Transformation

Object Recognition (CVPR 2006)

Page 38: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Reconstruction

Single-view reconstruction (SIGGRAPH 2005)

Page 39: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Secene Geometry Estimation

Getting spatial layout in indoor scenes (ICCV

2009)

Page 40: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Augmented Reality

Inserting synthetic objects into images

Page 41: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

3D Scene Reconstruction

Creating detailed and complete 3D scene models from a

single view (ongoing)

Page 42: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Lane Detection

B. Benligiray, C. Topal, C. Akinlar, Video-based lane detection using a fast vanishing point estimation

method, IEEE Int. Symposium Multimedia (ISM), 2012.

Page 43: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Modeling projection

Projection equation:

Source: J. Ponce, S. Seitz

),(),,(z

yf

z

xfzyx

x

y

z

f

Page 44: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Homogeneous coordinates

Is this a linear transformation?

Trick: add one more coordinate:

homogeneous image

coordinates

homogeneous scene

coordinates

Converting from homogeneous coordinates

• no—division by z is nonlinear

Slide by Steve Seitz

),(),,(z

yf

z

xfzyx

Page 45: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Projection: world coordinates image coordinates

Camera

Center

(tx, ty, tz)

Z

Y

X

P.

.

. f Z

Y

v

up

.

Optical

Center

(u0, v0)

v

u

X

Page 46: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Homogeneous coordinates

Invariant to scaling

Point in Cartesian is ray in Homogeneous

w

y

wx

kw

ky

kwkx

kw

ky

kx

w

y

x

k

Homogeneous Coordinates

Cartesian Coordinates

Page 47: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Basic geometry in homogeneous coordinates

Line equation: ax + by + c = 0

Append 1 to pixel coordinate to get homogeneous

coordinate

Line given by cross product of two points

Intersection of two lines given by cross product of the lines

1

i

i

i v

u

p

jiij ppline

jiij linelineq

i

i

i

i

c

b

a

line

Page 48: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Another problem solved by homogeneous coordinates

Cartesian: (Inf, Inf)

Homogeneous: (1, 1, 0)

Intersection of parallel lines

Cartesian: (Inf, Inf)

Homogeneous: (1, 2, 0)

Page 49: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

divide by the third

coordinate

Perspective Projection Matrix

Projection is a matrix multiplication using homogeneous

coordinates

z

yf

xf

z

y

x

f

f

10100

000

000

),(z

yf

z

xf

In practice: lots of coordinate transformations…

World to

camera coord.

trans. matrix

(4x4)

Perspective

projection matrix

(3x4)

Camera to

pixel coord.

trans. matrix

(3x3)

=2D

point

(3x1)

3D

point

(4x1)

Page 50: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

X0IKx

10100

000

000

1z

y

x

f

f

v

u

w

K

Slide Credit: Saverese

Projection matrix

Intrinsic Assumptions

• Unit aspect ratio

• Optical center at (0,0)

• No skew

Extrinsic Assumptions• No rotation

• Camera at (0,0,0)

Page 51: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Remove assumption: known optical center

X0IKx

10100

00

00

1

0

0

z

y

x

vf

uf

v

u

w

Intrinsic Assumptions

• Unit aspect ratio

• No skew

Extrinsic Assumptions• No rotation

• Camera at (0,0,0)

Page 52: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Remove assumption: square pixels

X0IKx

10100

00

00

1

0

0

z

y

x

v

u

v

u

w

Intrinsic Assumptions• No skew

Extrinsic Assumptions• No rotation

• Camera at (0,0,0)

Page 53: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Remove assumption: non-skewed pixels

X0IKx

10100

00

0

1

0

0

z

y

x

v

us

v

u

w

Intrinsic Assumptions Extrinsic Assumptions• No rotation

• Camera at (0,0,0)

Note: different books use different notation for parameters

Page 54: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Degrees of freedom

XtRKx

1100

0

1 333231

232221

131211

0

0

z

y

x

trrr

trrr

trrr

v

us

v

u

w

z

y

x

5 6

Page 55: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Vanishing Point = Projection from Infinity

R

R

R

z

y

x

z

y

x

z

y

x

KpKRptRKp

0

R

R

R

z

y

x

vf

uf

v

u

w

100

0

0

1

0

0 0uz

fxu

R

R

0vz

fyv

R

R

Page 56: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Orthographic Projection

Special case of perspective projection• Distance from center of projection to image plane is infinite

• Also called “parallel projection”

Image World

Slide by Steve Seitz

Page 57: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Orthographic Projection

Special case of perspective projection• Distance from center of projection to image plane is infinite

• Also called “parallel projection”

Page 58: Perspective projection - eskisehir.edu.treem.eskisehir.edu.tr/cihant/EEM 561/icerik/lec02_ct... · Perspective Projection Matrix Projection is a matrix multiplication using homogeneous

Orthographic Projection

Special case of perspective projection• Distance from center of projection to image plane is infinite

• Also called “parallel projection”

• What’s the projection matrix?

Image World

Slide by Steve Seitz