1 of 77

Cameras

CS5670: Computer Vision

Source: S. Lazebnik

2 of 77

Can we use homographies to create a 360 panorama?

  • In order to figure this out, we need to learn what a camera is

3 of 77

Image formation

Let’s design a camera

    • Idea 1: put a piece of film in front of an object
    • Do we get a reasonable image?
    • No. This is a bad camera.

4 of 77

Pinhole camera

Add a barrier to block off most of the rays

    • This reduces blurring
    • The opening known as the aperture
    • How does this transform the image?

5 of 77

Camera Obscura

  • Basic principle known to Mozi (470-390 BC), Aristotle (384-322 BC)
  • Drawing aid for artists: described by Leonardo da Vinci (1452-1519)

Gemma Frisius, 1558

Source: A. Efros

6 of 77

Camera Obscura

7 of 77

Home-made pinhole camera

Why so blurry?

Slide by A. Efros

8 of 77

Pinhole photography

Justin Quinnell, The Clifton Suspension Bridge. December 17th 2007 - June 21st 2008�6-month exposure

9 of 77

10 of 77

Shrinking the aperture

  • Why not make the aperture as small as possible?
    • Less light gets through
    • Diffraction effects...

11 of 77

Shrinking the aperture

12 of 77

Adding a lens

A lens focuses light onto the film

    • There is a specific distance at which objects are “in focus”
      • other points project to a “circle of confusion” in the image
    • Changing the shape of the lens changes this distance

“circle of

confusion”

13 of 77

The eye

The human eye is a camera

    • Iris - colored annulus with radial muscles
    • Pupil - the hole (aperture) whose size is controlled by the iris
    • What’s the “film”?
      • photoreceptor cells (rods and cones) in the retina

14 of 77

15 of 77

16 of 77

Eyes in nature: �eyespots to pinhole camera

http://upload.wikimedia.org/wikipedia/commons/6/6d/Mantis_shrimp.jpg

17 of 77

Projection

18 of 77

Projection

19 of 77

Müller-Lyer Illusion

20 of 77

Geometric Model: A Pinhole Camera

Figure credit: Peter Hedman

21 of 77

Modeling projection

  • The coordinate system
    • We use the pinhole model as an approximation
    • Put the optical center (aka Center of Projection, or COP) at the origin
    • Put the Image Plane (aka Projection Plane) in front of the COP (Why)?
    • The camera looks down the positive z-axis, and the y-axis points down
      • we like this if we want right-handed-coordinates
      • other versions are possible (e.g., OpenGL)

z

x

y

(x, y, z)

(x’, y’, f)

f

Center of Projection (COP)

Image Plane

22 of 77

Modeling projection

z

x

y

(x, y, z)

(x’, y’, f)

f

Center of Projection (COP)

Image Plane

  • Projection equations
    • Compute intersection with PP of ray from (x,y,z) to COP
    • Derived using similar triangles

    • We get the projection by throwing out the last coordinate:

23 of 77

Great Camera Demo

24 of 77

Modeling projection

  • Is this a linear transformation?

Homogeneous coordinates to the rescue—again!

homogeneous image

coordinates

homogeneous scene

coordinates

Converting from homogeneous coordinates

    • no—division by z is nonlinear

25 of 77

Perspective Projection

Projection is a matrix multiply using homogeneous coordinates:

This is known as perspective projection

    • The matrix is the projection matrix
    • (Can also represent as a 4x4 matrix – OpenGL does something like this)

divide by third coordinate

26 of 77

Perspective Projection

How does scaling the projection matrix change the transformation?

Scale by f:

Scaling a projection matrix produces an equivalent projection matrix!

27 of 77

Orthographic projection

  • Special case of perspective projection
    • Distance from the COP to the PP is infinite

    • Good approximation for telephoto optics
    • Also called “parallel projection”: (x, y, z) → (x, y)
    • What’s the projection matrix?

Image

World

28 of 77

Orthographic projection

29 of 77

Perspective projection

30 of 77

Variants of orthographic projection

  • Scaled orthographic
    • Also called “weak perspective”

  • Affine projection
    • Also called “paraperspective”

31 of 77

Dimensionality Reduction Machine (3D to 2D)

Figures © Stephen E. Palmer, 2002

3D world

2D image

What have we lost?

    • Angles
    • Distances (lengths)

Slide by A. Efros

32 of 77

Projection properties

  • Many-to-one: any points along same ray map to same point in image
  • Points → points
  • Lines → lines (collinearity is preserved)
    • But line through focal point projects to a point
  • Planes → planes (or half-planes)
    • But plane through focal point projects to line

33 of 77

Projection properties

  • Parallel lines converge at a vanishing point
    • Each direction in space has its own vanishing point
    • But parallel lines parallel to the image plane remain parallel

34 of 77

Questions?

35 of 77

Camera parameters

  • How can we model the geometry of a camera?

“The World”

Camera

x

y

z

v

w

u

o

COP

Three important coordinate systems:

  1. World coordinates
  2. Camera coordinates
  3. Image coordinates

(x, y, z)

How do we project a given world point (x, y, z) to an image point?

36 of 77

Recap: coordinate frames

World coordinates

Camera coordinates

Image coordinates

Figure credit: Peter Hedman

37 of 77

Camera parameters

To project a point (x, y, z) in world coordinates into a camera

  • First transform (x, y, z) into camera coordinates
  • Need to know
    • Camera position (in world coordinates)
    • Camera orientation (in world coordinates)
  • Then project into the image plane to get image (pixel) coordinates
    • Need to know camera intrinsics

38 of 77

Camera parameters

Projection equation

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

projection

intrinsics

rotation

translation

identity matrix

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, principal point (cx, cy), pixel aspect size α
    • 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

39 of 77

Projection matrix

0

=

(in homogeneous image coordinates)

40 of 77

Extrinsics: from world to camera coordinates

  • How do we get the camera to “canonical form”?
    • Canonical form: Center of projection at the origin, x-axis points right, y-axis points down, z-axis points forwards

Step 1: Translate by -c

0

41 of 77

Extrinsics: from world to camera coordinates

0

Step 1: Translate by -c

How do we represent translation as a matrix multiplication?

  • How do we get the camera to “canonical form”?
    • Canonical form: Center of projection at the origin, x-axis points right, y-axis points down, z-axis points forwards

42 of 77

Extrinsics: from world to camera coordinates

Step 1: Translate by -c

Step 2: Rotate by R

3x3 rotation matrix

0

  • How do we get the camera to “canonical form”?
    • Canonical form: Center of projection at the origin, x-axis points right, y-axis points down, z-axis points forwards

43 of 77

Extrinsics: from world to camera coordinates

0

Step 1: Translate by -c

Step 2: Rotate by R

(with extra row/column of [0 0 0 1])

  • How do we get the camera to “canonical form”?
    • Canonical form: Center of projection at the origin, x-axis points right, y-axis points down, z-axis points forwards

44 of 77

Perspective projection

(intrinsics)

in general,

: aspect ratio (1 unless pixels are not square)

: skew (0 unless pixels are shaped like rhombi/parallelograms)

: principal point ((w/2,h/2) unless optical axis doesn’t intersect projection plane at image center)

(upper triangular matrix)

(converts from 3D rays in camera coordinate system to pixel coordinates)

45 of 77

Typical intrinsics matrix

  • 2D affine transform corresponding to a scale by f (focal length) and a translation by (cx, cy) (principal point)
  • Maps 3D rays to 2D pixels

46 of 77

Focal length

  • Can think of as “zoom”

  • Also related to field of view

24mm

50mm

200mm

800mm

47 of 77

Field of view

48 of 77

Fredo Durand

49 of 77

Fredo Durand

50 of 77

Fredo Durand

51 of 77

Fredo Durand

52 of 77

Dolly zoom

53 of 77

54 of 77

Fredo Durand

55 of 77

Projection matrix

translation

rotation

projection

intrinsics

This part converts 3D points in world coordinates to 3D rays in the camera’s coordinate system. There are 6 parameters represented (3 for position/translation, 3 for rotation).

The K matrix converts 3D rays in the camera’s coordinate system to 2D image points in image (pixel) coordinates.

56 of 77

Projection matrix

(t in book’s notation)

translation

rotation

projection

intrinsics

57 of 77

Projection matrix

0

=

(in homogeneous image coordinates)

58 of 77

Questions?

59 of 77

Perspective distortion

  • Problem for architectural photography: converging verticals

Source: F. Durand

60 of 77

Perspective distortion

  • Problem for architectural photography: converging verticals����

  • Solution: view camera (lens shifted w.r.t. film)

Source: F. Durand

Tilting the camera upwards results in converging verticals

Keeping the camera level, with an ordinary lens, captures only the bottom portion of the building

Shifting the lens upwards results in a picture of the entire subject

61 of 77

Perspective distortion

  • Problem for architectural photography: converging verticals
  • Result:

Source: F. Durand

62 of 77

Perspective distortion

  • What does a sphere project to?

Image source: F. Durand

63 of 77

Perspective distortion

  • The exterior columns appear bigger
  • The distortion is not due to lens flaws
  • Problem pointed out by Da Vinci

Slide by F. Durand

64 of 77

65 of 77

Perspective distortion: People

66 of 77

Distortion-Free Wide-Angle Portraits on Camera Phones

YiChang Shih, Wei-Sheng Lai, and Chia-Kai Liang, Distortion-Free Wide-Angle Portraits on Camera Phones, SIGGRAPH 2019

https://people.csail.mit.edu/yichangshih/wide_angle_portrait/

67 of 77

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

68 of 77

69 of 77

Radial distortion

  • Arrows show motion of projected points relative to an ideal (distortion-free lens)

70 of 77

Correcting radial distortion

71 of 77

Distortion

72 of 77

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

73 of 77

Other types of projection

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

74 of 77

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…

75 of 77

Tilt-shift

Tilt-shift images from Olivo Barbieri�and Photoshop imitations

76 of 77

Rotating sensor (or object)

Rollout Photographs © Justin Kerr

Also known as “cyclographs”, “peripheral images”

77 of 77

Questions?