Geometrical Primitives, Transformations and Image...

50
Geometrical Primitives, Transformations and Image Formation EECS 598-08 Fall 2014 Foundations of Computer Vision http://web.eecs.umich.edu/~jjcorso/t/598F14 Instructor: Jason Corso [email protected] Materials on these slides have come from many sources in addition to myself; I am infinitely grateful to these, especially Greg Hager and Silvio Savarese.

Transcript of Geometrical Primitives, Transformations and Image...

Page 1: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometrical Primitives, Transformations and Image Formation

EECS 598-08 Fall 2014!Foundations of Computer Vision!

!http://web.eecs.umich.edu/~jjcorso/t/598F14!

!Instructor: Jason Corso!

[email protected]!

Materials on these slides have come from many sources in addition to myself; I am infinitely grateful to these, especially Greg Hager and Silvio Savarese.!

Page 2: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Plan

•  Geometric Primitives!–  Points, Lines in 2D and 3D!–  Transformations in 2D and 3D!

•  Basic Image Formation!•  Camera Parameters!•  Lens Distortion!

2

Page 3: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometric Primitives

•  2D points: pixel coordinates!

•  Using homogeneous coordinates!–  Vectors differing by scale are equivalent.!

–  When the last element , call it an ideal point.!

3

augmented vector!

2D Projective Space!

Page 4: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometric Primitives

•  2D lines with homogeneous coordinates!

•  Normalized coordinates!

•  Polar coordinates!

4

normal vector!

The image on this slides is sourced from the Szeliski book.!

Page 5: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometric Primitives

•  Intersection of two lines!

•  Line connecting two points!

5

Page 6: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometric Primitives

•  3D points!

6

Page 7: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometric Primitives

•  3D planes!

•  Spherical coordinates!–  can be written as a function

of two angles .!

7

Images on this slides are sourced from the Szeliski book and Wolfram website.!

Page 8: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometric Primitives

•  3D lines!–  Consider two points on the line .!

–  For the case of homogeneous coordinates:!

–  When the second point is at infinity, !

8

The image on this slides is sourced from the Szeliski book.!

Page 9: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometric Transformations

•  2D translation!

!•  2D rotation and translation!

–  2D rigid body or Euclidean transformation!

9

Identity matrix!

Rotation!matrix!

Page 10: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometric Transformations

•  2D scaled rotation or similarity transform!

–  Constraint is not enforced. !

•  2D affine transformation!

10

Page 11: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Geometric Transformations

•  2D projective, also called the homography!

•  Projective matrix is defined up to scale. !•  Inhomogeneous results are computed after homogeneous

operation.!

11

Page 12: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Hierarchy of 2D Planar Transformations 12

The images on this slides are sourced from the Szeliski book.!

Page 13: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Hierarchy of 3D Coordinate Transformations 13

Page 14: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Projective Geometry

•  These geometry basics are but the surface of an area important to computer vision called projective geometry.!

•  Further reading: “An Introduction to Projective Geometry” by Stan Birchfield.!

14

Page 15: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

15

Page 16: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Light

•  Getting light to the sensor.!

•  What does this image look like?!

16

Source: S. Savarese, GD Hager and S Seitz slides.!

Page 17: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Light through a pinhole

•  Place a barrier in front of the film.!•  Let a small pinhole of light through.!

–  aperture!

17

Source: D. Forsyth, S. Savarese, GD Hager and S Seitz slides.!

Leonardo da Vinci (1452-1519): Camera Obscura!

Page 18: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Light through a pinhole

•  Pinhole: box with a small hole in it.!–  Abstract model that does indeed work in practice.!

18

aperture!

focal length!

Source: D. Forsyth, S. Savarese slides.!

Page 19: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Pinhole, or Central, Perspective

•  Points are collinear.!

•  Therefore, we have and .!!

19

Source: D. Forsyth, S. Savarese slides.!

Page 20: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Properties of Pinhole Perspective Projection

•  Distant objects appear smaller!

20

Source: D. Forsyth, S. Savarese slides.!

Page 21: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Properties of Pinhole Perspective Projection

•  Points project to points!•  Lines project to lines!

•  Angles are not preserved.!•  Parallel lines meet!!

21

Source: S. Savarese slides.!

Vanishing Point!

Page 22: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

22

Fun with vanishing points

Source: S. Seitz slides.!

Page 23: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

23

Perspective cues

Source: S. Seitz slides.!

Page 24: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

24

Perspective cues

Source: S. Seitz slides.!

Page 25: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

25

Perspective cues

Source: S. Seitz slides.!

Page 26: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Pinhole, or Central, Perspective

•  It is common to draw the image plane in front of the focal point.!

26

Source: D. Forsyth, S. Savarese slides.!

Page 27: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Weak Perspective

•  A coarser approximation to image formation is called weak perspective, or scaled orthography.!

•  Consider a fronto-parallel plane defined by .!•  Rewrite projection equations for any point in !

27

Source: D. Forsyth, S. Savarese slides.!

Page 28: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Orthographic Projections

•  Further, when the camera will be at a fixed distance from the scene, we can further normalize the coordinates.!–  Make !–  Then and !

•  Almost never an acceptable model for image formation.!!

28

Source: D. Forsyth, S. Savarese slides.!

Page 29: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Projection Matrices

•  Can formulate the perspective projections as matrix operations with homogeneous coordinates.!

!•  Why are homogeneous coordinates necessary here?!•  Can also formulate as a 4x4 projection.!

29

Page 30: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Projection Matrices

•  How does scaling affect the projection?!

!

30

Page 31: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Role of aperture size

•  When aperture is big, what happens?!

!!!•  Why not make the

aperture as small as possible?!–  Not enough light

gets through.!–  Diffraction.!

31

Source: S. Seitz, S. Savarese slides.!

Page 32: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Adding a lens

•  A lens focuses the light onto the film/CCD.!•  Rays passing through the center are not deviated.!•  All parallel rays converge to one point on a plane located at the

focal length f.!

focal point

f

optical center (Center Of Projection)

focal point

32

Source: GD Hager and S Seitz slides.!

Page 33: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Pinhole vs. lens 33

Source: GD Hager and S Seitz slides.!

Page 34: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Thin lens equation 34

Source: GD Hager and S Seitz slides.!

•  How to relate distance of object from optical center ( ) to the distance at which it will be in focus ( ), given focal length ?!

Page 35: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Thin lens equation 35

Source: GD Hager and S Seitz slides.!

•  How to relate distance of object from optical center ( ) to the distance at which it will be in focus ( ), given focal length ?!

Page 36: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Thin lens equation 36

Source: GD Hager and S Seitz slides.!

•  How to relate distance of object from optical center ( ) to the distance at which it will be in focus ( ), given focal length ?!

Page 37: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Thin lens equation 37

•  Any object point satisfying this equation is in focus!

Source: GD Hager and S Seitz slides.!

Page 38: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Depth of field

•  Changing the aperture size affects depth of field –  A smaller aperture increases the range in which the

object is approximately in focus

f / 5.6

f / 32

Flower images from Wikipedia http://en.wikipedia.org/wiki/Depth_of_field !Source: S Seitz slides.!

Page 39: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Projection equation

•  The projection matrix models the cumulative effect of all parameters •  Useful to decompose into a series of operations

ΠXx =

⎥⎥⎥⎥

⎢⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

=

⎥⎥⎥

⎢⎢⎢

=

1************

ZYX

ssysx

⎥⎥⎦

⎢⎢⎣

⎥⎥⎦

⎢⎢⎣

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

=110100

00100001

100'0'0

31

1333

31

1333

x

xx

x

xxcy

cx

yfsxfs

000 TIRΠ

projection intrinsics rotation translation

identity matrix

Camera parameters A camera is described by several parameters

•  Translation T of the optical center from the origin of world coords •  Rotation R of the image plane •  focal length f, principle point (x’c, y’c), pixel size (sx, sy) •  blue parameters are called “extrinsics,” red are “intrinsics”

•  The definitions of these parameters are not completely standardized –  especially intrinsics—varies from one book to another Source: S Seitz slides.!

Page 40: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Radial Distortion

•  Pin Cushion!

•  Barrel / Fisheye!

40

Source: S Savarese slides.!

Page 41: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Radial Distortion

•  Radial distortion of the image –  Caused by imperfect lenses –  Deviations are most noticeable for rays that pass

through the edge of the lens

No distortion Pin cushion Barrel

Source: S Seitz slides.!

Page 42: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Correcting radial distortion

from Helmut Dersch Source: S Seitz slides.!

Page 43: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Distortion

Source: S Seitz slides.!

Page 44: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Modeling distortion

•  To model lens distortion –  Use above projection operation instead of standard

projection matrix multiplication

Apply radial distortion

Apply focal length translate image center

Project to “normalized”

image coordinates

Source: S Seitz slides.!

Page 45: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

45

Page 46: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Other types of projection

•  Lots of intriguing variants… •  (I’ll just mention a few fun ones)

Source: S Seitz slides.!

Page 47: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

360 degree field of view…

•  Basic approach –  Take a photo of a parabolic mirror with an orthographic lens (Nayar) –  Or buy one a lens from a variety of omnicam manufacturers…

•  See http://www.cis.upenn.edu/~kostas/omni.html

Source: S Seitz slides.!

Page 48: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Tilt-shift

Titlt-shift images from Olivo Barbieri and Photoshop imitations

http://www.northlight-images.co.uk/article_pages/tilt_and_shift_ts-e.html

Source: S Seitz slides.!

Page 49: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Rollout Photographs © Justin Kerr http://research.famsi.org/kerrmaya.html

Rotating sensor (or object)

Also known as “cyclographs”, “peripheral images”

Source: S Seitz slides.!

Page 50: Geometrical Primitives, Transformations and Image Formationjjcorso/t/598F14/files/lecture_0915_cameras.pdfThe image on this slides is sourced from the Szeliski book.! Geometric Transformations

Photofinish

Source: S Seitz slides.!