56

Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental
Page 2: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental
Page 3: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Capturing Light:Geometry of Image Formation

Computer Vision

James Hays

Slides from Derek Hoiem,

Alexei Efros, Steve Seitz, and

David Forsyth

Page 4: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Administrative Stuff

• My Office hours, CoC building 315

– Monday and Wednesday 1-2

• TA Office hours

– To be announced

• Project 1 goes out today

• Piazza should be your first stop for help

• Matlab is available for students from OIT

– software.oit.gatech.edu

Page 5: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Scope of CS 4476

Computer Vision Robotics

Neuroscience

Graphics

Computational

Photography

Machine

Learning

Medical

Imaging

Human

Computer

Interaction

Optics

Image Processing

Geometric Reasoning

Recognition

Deep Learning

Previous class: Introduction

Page 6: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

The Geometry of Image Formation

Mapping between image and world coordinates

– Pinhole camera model

– Projective geometry

• Vanishing points and lines

– Projection matrix

Page 7: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

What do you need to make a camera from scratch?

Page 8: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

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?

Slide source: Seitz

Page 9: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Pinhole camera

Idea 2: add a barrier to block off most of the rays

– This reduces blurring

– The opening known as the aperture

Slide source: Seitz

Page 10: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Pinhole camera

Figure from Forsyth

f

f = focal length

c = center of the camera

c

Page 11: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Camera obscura: the pre-camera

• Known during classical period in China and Greece (e.g. Mo-Ti, China, 470BC to 390BC)

Illustration of Camera Obscura Freestanding camera obscura at UNC Chapel Hill

Photo by Seth Ilys

Page 12: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Camera Obscura used for Tracing

Lens Based Camera Obscura, 1568

Page 13: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Accidental Cameras

Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture.

Antonio Torralba, William T. Freeman

Page 14: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Accidental Cameras

Page 15: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

First Photograph

Oldest surviving photograph

– Took 8 hours on pewter plate

Joseph Niepce, 1826

Photograph of the first photograph

Stored at UT Austin

Niepce later teamed up with Daguerre, who eventually created Daguerrotypes

Page 16: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Today’s class: Camera and World 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 17: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Point of observation

Figures © Stephen E. Palmer, 2002

Dimensionality Reduction Machine (3D to 2D)

3D world 2D image

Page 18: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Projection can be tricky…Slide source: Seitz

Page 19: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Projection can be tricky…Slide source: Seitz

Page 20: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Projective Geometry

What is lost?

• Length

Which is closer?

Who is taller?

Page 21: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Length and area are not preserved

Figure by David Forsyth

B’

C’

A’

Page 22: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Earth as an example

Page 23: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

ISS timelapse. 400 kilometers from Earth

Page 24: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

“The Blue Marble”, taken on

December 7, 1972, by the

crew of the Apollo 17

spacecraft, at a distance of

about 45,000 kilometers

Page 25: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental
Page 26: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Earth from Curiosity Rover, 2014, 160 million kilometers from Earth

Page 27: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Earth from Curiosity Rover, 2014, 160 million kilometers from Earth

Page 28: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

“Pale Blue Dot” from Voyager 1, February 14, 1990, 6 billion kilometers from Earth

Consider again that dot. That's here. That's

home. That's us. On it everyone you love,

everyone you know, everyone you ever heard

of, every human being who ever was, lived

out their lives. The aggregate of our joy and

suffering, thousands of confident religions,

ideologies, and economic doctrines, every

hunter and forager, every hero and coward,

every creator and destroyer of civilization,

every king and peasant, every young couple

in love, every mother and father, hopeful

child, inventor and explorer, every teacher of

morals, every corrupt politician, every

"superstar," every "supreme leader," every

saint and sinner in the history of our species

lived there – on a mote of dust suspended in

a sunbeam.

Carl Sagan

Page 29: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Projective Geometry

What is lost?

• Length

• Angles

Perpendicular?

Parallel?

Page 30: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Projective Geometry

What is preserved?

• Straight lines are still straight

Page 31: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Vanishing points and lines

Parallel lines in the world intersect in the image at a “vanishing point”

Page 32: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Vanishing points and lines

oVanishing Point o

Vanishing Point

Vanishing Line

Page 33: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Vanishing points and lines

Vanishingpoint

Vanishingpoint

Vertical vanishingpoint

(at infinity)

Slide from Efros, Photo from Criminisi

Page 34: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Projection: world coordinatesimage coordinates

Camera

Center

(0, 0, 0)

Z

Y

X

P.

.

. f Z Y

V

Up

.V

U

If X = 2, Y = 3, Z = 5, and f = 2

What are U and V?

Page 35: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Projection: world coordinatesimage coordinates

Camera

Center

(0, 0, 0)

Z

Y

X

P.

.

. f Z Y

V

Up

.V

U

Z

fXU *

Z

fYV *

5

2*2U

5

2*3V

Sanity check, what if f and Z are equal?

Page 36: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Projection: world coordinatesimage coordinates

Camera

Center

(tx, ty, tz)

Z

Y

X

P.

.

. f Z Y

v

up

.

Optical

Center

(u0, v0)

v

u

Page 37: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Interlude: why does this matter?

Page 38: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Relating multiple views

Page 39: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental
Page 40: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Homogeneous coordinates

Conversion

Converting to homogeneous coordinates

homogeneous image

coordinates

homogeneous scene

coordinates

Converting from homogeneous coordinates

Page 41: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

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 42: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Slide Credit: Savarese

Projection matrix

XtRKx x: Image Coordinates: (u,v,1)

K: Intrinsic Matrix (3x3)

R: Rotation (3x3)

t: Translation (3x1)

X: World Coordinates: (X,Y,Z,1)

Ow

iw

kw

jwR,t

X

x

Page 43: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

X0IKx

10100

000

000

1z

y

x

f

f

v

u

w

K

Slide Credit: Savarese

Projection matrix

Intrinsic Assumptions

• Unit aspect ratio

• Optical center at (0,0)

• No skew

Extrinsic Assumptions• No rotation

• Camera at (0,0,0)

X

x

Page 44: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

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 45: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

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 46: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

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 47: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Oriented and Translated Camera

Ow

iw

kw

jw

t

R

X

x

Page 48: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Allow camera translation

XtIKx

1100

010

001

100

0

0

1

0

0

z

y

x

t

t

t

v

u

v

u

w

z

y

x

Intrinsic Assumptions Extrinsic Assumptions• No rotation

Page 49: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

3D Rotation of Points

Rotation around the coordinate axes, counter-clockwise:

100

0cossin

0sincos

)(

cos0sin

010

sin0cos

)(

cossin0

sincos0

001

)(

z

y

x

R

R

R

p

p’

y

z

Slide Credit: Saverese

Page 50: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Allow camera rotation

XtRKx

1100

0

1 333231

232221

131211

0

0

z

y

x

trrr

trrr

trrr

v

us

v

u

w

z

y

x

Page 51: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

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 52: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Orthographic Projection

• Special case of perspective projection

– Distance from the COP to the image plane is infinite

– Also called “parallel projection”

– What’s the projection matrix?

Image World

Slide by Steve Seitz

11000

0010

0001

1z

y

x

v

u

w

Page 53: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Field of View (Zoom, focal length)

Page 54: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Beyond Pinholes: Radial Distortion

Image from Martin Habbecke

Corrected Barrel Distortion

Page 55: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Things to remember

• Vanishing points and vanishing lines

• Pinhole camera model and camera projection matrix

• Homogeneous coordinates

Vanishingpoint

Vanishingline

Vanishingpoint

Vertical vanishingpoint

(at infinity)

XtRKx

Page 56: Capturing Light: Geometry of Image Formation€¦ · Accidental Pinhole and Pinspeck Cameras Revealing the scene outside the picture. Antonio Torralba, William T. Freeman. Accidental

Next class

• Light, color, and sensors