44
Camera Models and Perspective Projection

Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Camera Models andPerspective Projection

Page 2: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Camera Models

Prof. Schrater

Page 3: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Cameras

• First photograph due to Niepce• First on record shown in the book -

1822• Basic abstraction is the pinhole camera

– lenses required to ensure image is not toodark

– various other abstractions can be applied

Page 4: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Pinhole cameras

• Abstract cameramodel - box with asmall hole in it

• Pinhole cameraswork in practice

Page 5: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Vasari’s Portrait ofFilippo Brunelleschi

Edgerton’s depiction of the reverse-reflection ‘peepshow’ of theBaptistry with which Brunelleschi demonstrated perspective in ~1420

Copyright Christopher Tyler

Page 6: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

The ‘Goldman’Annunciation

by Masolino

(1424)

This complexarchitecture isestimated to havepredated (and mayhave inspired)Masaccio’s ‘Trinity’by four years.

Copyright Christopher Tyler

Page 7: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

The accurate perspective extends from the arch in the backgroundto to the coffers of the portico . . .

Copyright Christopher TylerCopyright Christopher Tyler

Page 8: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

. . . and even details of the Virgin’s throne in the right foreground.

Copyright Christopher Tyler

Page 9: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

As required in accurate perspective, the 45º obliques project todistance points at the same height as the central vanishing point.

Copyright Christopher Tyler

Page 10: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Viewpoint dependentProjections

Samuel von Hoogstraten

Page 11: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First
Page 12: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First
Page 13: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

What’s wrong?

Ron Davis Six-Ninths Blue, 1966 Ames Room

Page 14: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First
Page 15: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Geometric properties ofprojection

• Points go to points• Lines go to lines• Planes go to whole image• Polygons go to polygons

• Degenerate cases– line through focal point to

point– plane through focal point

to line

Page 16: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Distant objects are smaller

Page 17: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Parallel lines meetCommon to draw film planein front of the focal point.Moving the film plane merelyscales the image.

Page 18: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Polyhedra project to polygons

• (because linesproject to lines)

Page 19: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Can we invert?Polygons -> Polyhedra?

• Although not unique,methods for interpretingline drawing exist.

• Key idea:– Classify junctions– look for consistent sets of

line labels, boundingpolyhedra

– “line labelling” - e.g.• Boundary lines• Corners (convex vertices)

– Practical problem - too hardto extract lines andjunctions to label from realimages

Junctions

Interpret drawing in termsof a set of planar facets--Assign lines to facetsDetermine facet normals

Page 20: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Curved surfaces are much moreinteresting under projection

• Crucial issue:outline is the set ofpoints where theviewing direction istangent to thesurface

• This is a projectionof a space curve,which varies fromview to view of thesurface

Page 21: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Vanishing points

• each set of parallel lines(=direction) meets at adifferent point– The vanishing point for

this direction

• Sets of parallel lines onthe same plane lead tocollinear vanishingpoints.– The line is called the

horizon for that plane

• Good ways to spotfaked images– scale and

perspective don’twork

– vanishing pointsbehave badly

– supermarket tabloidsare a great source.

Page 22: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Faked Photos

Page 23: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

One Point

Two Point

Three Point

Page 24: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

The equation of projection• If you know P=(x,y,z) and f’, what is P’?

– Where does a point in view space end up onthe screen?

Page 25: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

The equation of projection

• Cartesiancoordinates:– We have, by similar

triangles, that(x, y, z) -> (f x/z, fy/z, -f)

!

(x, y, z)" ( fx

z, fy

z)

y

-z

P(x,y,z)P’(xs,ys)

View Planef

–Ignore the third coordinate, and get

y/z = ys /f

Page 26: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Homogenous coordinates

• Add an extra coordinateand use an equivalencerelation

• for 2D– equivalence relation

k*(X,Y,Z) is the same as(X,Y,Z)

• for 3D– equivalence relation

k*(X,Y,Z,T) is the sameas (X,Y,Z,T)

• Basic notion– Possible to represent

points “at infinity”• Where parallel lines

intersect• Where parallel planes

intersect– Possible to write the

action of aperspective cameraas a matrix

Page 27: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

The camera matrix

• Turn previousexpression into HC’s– HC’s for 3D point are

(X,Y,Z,T)– HC’s for point in

image are (U,V,W)

!

U

V

W

"

#

$ $ $

%

&

' ' '

=

1 0 0 0

0 1 0 0

0 0 1f0

"

#

$ $ $ $

%

&

' ' ' '

X

Y

Z

T

"

#

$ $ $ $ $

%

&

' ' ' ' '

xs =U/W ys =U/W

Relation between HC’s and image coordinates

Page 28: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Weak perspective• Issue

– perspective effects onlylarge with depthvariation-

– Perspective effectsfrequently small over thescale of individual objects

– collect points into a groupat about the same depth,then divide each point bythe depth of its group

– Adv: easy– Disadv: wrong

Page 29: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Orthographic projection

Page 30: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Orthographic via TelecentricLens

Page 31: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

The projection matrix fororthographic projection

!

U

V

W

"

#

$ $ $

%

&

' ' '

=

1 0 0 0

0 1 0 0

0 0 0 1

"

#

$ $ $

%

&

' ' '

X

Y

Z

T

"

#

$ $ $ $ $

%

&

' ' ' ' '

Page 32: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

The reason for lenses

Page 33: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Pinhole too big - many directions are averaged, blurring the image

Pinhole too small- diffraction effects blur the image

Generally, pinhole cameras are dark, becausea very small set of raysfrom a particular pointhits the screen.

Page 34: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

The thin lens

1

z'-1

z=1

f

f = R 2(n-1)

z’ = z f/(z+f)

Page 35: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Is limited focus bad?1) Know your current focal length2) Blur gradient => Depth

Page 36: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Spherical aberration

Page 37: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Lens systems

Page 38: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Vignetting

Page 39: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Other (possibly annoying)phenomena

• Chromatic aberration– Light at different wavelengths follows different paths; hence,

some wavelengths are defocussed– Machines: coat the lens– Humans: live with it

• Scattering at the lens surface– Some light entering the lens system is reflected off each

surface it encounters (Fresnel’s law gives details)– Machines: coat the lens, interior– Humans: live with it (various scattering phenomena are

visible in the human eye)• Geometric phenomena (Barrel distortion, etc.)

Page 40: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Human Eye-thick lens

Page 41: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First
Page 42: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

CCD Cameras

Noise sources: 1) Spatial response/Efficiency2) Thermal fluctuations3) Shot Noise4) Read Noise (amplifier)5) Quantization

Page 43: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Camera parameters

• Issue– camera may not be at the origin, looking down the z-axis

• extrinsic parameters– one unit in camera coordinates may not be the same as

one unit in world coordinates• intrinsic parameters - focal length, principal point, aspect

ratio, angle between axes, etc.

!

U

V

W

"

#

$ $ $

%

&

' ' '

=

Transformation

representing

intrinsic parameters

"

#

$ $ $

%

&

' ' '

1 0 0 0

0 1 0 0

0 0 1 0

"

#

$ $ $

%

&

' ' '

Transformation

representing

extrinsic parameters

"

#

$ $ $

%

&

' ' '

X

Y

Z

T

"

#

$ $ $ $ $

%

&

' ' ' ' '

Page 44: Camera Models and Perspective Projection - Vision Labsvision.psych.umn.edu/users/schrater/schrater_lab/courses/CompVis07/... · Cameras •First photograph due to Niepce •First

Camera calibration• Issues:

– what are intrinsicparameters of thecamera?

– what is the cameramatrix?(intrinsic+extrinsic)

• General strategy:– view calibration object– identify image points– obtain camera matrix by

minimizing error– obtain intrinsic

parameters from cameramatrix

• Error minimization:– Linear least squares

• easy problemnumerically

• solution can be ratherbad

– Minimize image distance• more difficult numerical

problem• solution usually rather

good,• start with linear least

squares– Numerical scaling is an

issue