CS 4495 Computer Vision N-Views (2) Essential and Fundamental - - PowerPoint PPT Presentation

cs 4495 computer vision n views 2 essential and
SMART_READER_LITE
LIVE PREVIEW

CS 4495 Computer Vision N-Views (2) Essential and Fundamental - - PowerPoint PPT Presentation

Two Views Part 2: Essential CS 4495 Computer Vision A. Bobick and Fundamental Matrices CS 4495 Computer Vision N-Views (2) Essential and Fundamental Matrices Aaron Bobick School of Interactive Computing Two Views Part 2: Essential


slide-1
SLIDE 1

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Aaron Bobick School of Interactive Computing

CS 4495 Computer Vision N-Views (2) – Essential and Fundamental Matrices

slide-2
SLIDE 2

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Administrivia

  • Today: Second half of N-Views (n = 2)
  • PS 3: Will hopefully be out by Thursday
  • Will be due October 6th.
  • Will be based upon last week and today’s material
  • We may revisit the logistics – suggestions?
slide-3
SLIDE 3

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Two views…and two lectures

  • Projective transforms from image to image
  • Some more projective geometry
  • Points and lines and planes
  • Two arbitrary views of the same scene
  • Calibrated – “Essential Matrix”
  • Two uncalibrated cameras “Fundamental Matrix”
  • Gives epipolar lines
slide-4
SLIDE 4

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Last time

  • Projective Transforms: Matrices that provide

transformations including translations, rotations, similarity, affine and finally general (or perspective) projection.

  • When 2D matrices are 3x3; for 3D they are 4x4.
slide-5
SLIDE 5

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Last time: Homographies

  • Provide mapping between images (image planes) taken

from same center of projection; also mapping between any images of a planar surface.

PP2 PP1

slide-6
SLIDE 6

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Last time: Projective geometry

  • A line is a plane of rays through origin

– all rays (x,y,z) satisfying: ax + by + cz = 0

[ ]

          = z y x c b a : notation vector in

  • A line is also represented as a homogeneous 3-vector l

l p

slide-7
SLIDE 7

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Projective Geometry: lines and points

p1 = x1 y1 1

[ ]

p2 = x2 y2 1

[ ]

l = p1 × p2 p1 p2

2D Lines:

[ ]

1 x a b c y     =       ax by c + + =

[ ]

x y

l a b c n n d   = ⇒  

d (nx, ny)

T

= l x

x12 l

1 = a1

b

1

c1

[ ]

l2 = a2 b2 c2

[ ]

x12 = l

1 × l2

Eq of line

slide-8
SLIDE 8

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Motivating the problem: stereo

  • Given two views of a scene (the two cameras not

necessarily having optical axes) what is the relationship between the location of a scene point in one image and its location in the other?

slide-9
SLIDE 9

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Stereo correspondence

  • Determine Pixel Correspondence
  • Pairs of points that correspond to same scene point

Epipolar Constraint

  • Reduces correspondence problem to 1D search along conjugate

epipolar lines

epipolar plane

epipolar line epipolar line CP1 CP2 P

slide-10
SLIDE 10

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Figure from Hartley & Zisserman

Example: converging cameras

slide-11
SLIDE 11

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Epipolar geometry: terms

  • Baseline: line joining the camera centers
  • Epipole: point of intersection of baseline with image plane
  • Epipolar plane: plane containing baseline and world point
  • Epipolar line: intersection of epipolar plane with the image

plane

  • All epipolar lines

intersect at the epipole

  • An epipolar plane

intersects the left and right image planes in corresponding epipolar lines

slide-12
SLIDE 12

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

From Geometry to Algebra

  • So far, we have the explanation in terms of

geometry.

  • Now, how to express the epipolar constraints

algebraically?

slide-13
SLIDE 13

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Stereo geometry, with calibrated cameras

Main idea

slide-14
SLIDE 14

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Stereo geometry, with calibrated cameras

If the stereo rig is calibrated, we know : how to rotate and translate camera reference frame 1 to get to camera reference frame 2.

Rotation: 3 x 3 matrix R; translation: 3 vector T.

slide-15
SLIDE 15

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Stereo geometry, with calibrated cameras

If the stereo rig is calibrated, we know : how to rotate and translate camera reference frame 1 to get to camera reference frame 2.

T RX X + =

c c

'

slide-16
SLIDE 16

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

An aside: cross product

Vector cross product takes two vectors and returns a third vector that’s perpendicular to both inputs. So here, c is perpendicular to both a and b, which means the dot product = 0.

a b c × =    a c b c ⋅ = ⋅ =    

slide-17
SLIDE 17

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

From geometry to algebra

= + X' RX T

T T RX T X T × + × = ′ × RX T× =

( ) ( )

RX T X X T X × ⋅ ′ = ′ × ⋅ ′

Normal to the plane

( )

′ = ⋅ × X T RX

slide-18
SLIDE 18

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Another aside: Matrix form of cross product

Can be expressed as a matrix multiplication!!!

c b b b a a a a a a b a    =                     − − − = ×

3 2 1 1 2 1 3 2 3

[ ]

          − − − =

1 2 1 3 2 3

a a a a a a ax

[ ]

a b a b

×

× =    

Notation:

Has rank 2!

slide-19
SLIDE 19

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

From geometry to algebra

= + X' RX T

T T RX T X T × + × = ′ × RX T× =

( ) ( )

RX T X X T X × ⋅ ′ = ′ × ⋅ ′

Normal to the plane

( )

′ = ⋅ × X T RX

slide-20
SLIDE 20

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Essential matrix

( )

= × ⋅ ′ RX T X

( )

] [T = ⋅ ′ RX X

x

E is called the essential matrix, and it relates corresponding image points between both cameras, given the rotation and translation. Note: these points are in each camera coordinate systems. We know if we observe a point in one image, its position in other image is constrained to lie on line defined by above.

Let

R E ] [T x =

= ′ EX X T

slide-21
SLIDE 21

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

[ ,0,0] T B

Τ

= = − = =

x

R I T E [ ]R

= ′ΤEp p

For the parallel cameras, image of any point must lie

  • n same horizontal line in

each image plane.

[ , , ] [ ', ', ] Z Zx Zy f Z Zx Zy f = = p p'

B f

x

l

xr

Z p

l

p

r

P COPL COPR

Essential matrix example: parallel cameras

[ ]

' ' 1 0 1 x x y B y B         =         −    

[ ]

' ' 1 x y B By     =     −   ' By By = ⇒ y' = y

0 0 0 0 0 B 0 –B 0

Given a known point (x,y) in the original image, this is a line in the (x’,y’) image.

slide-22
SLIDE 22

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Weak calibration

  • Want to estimate world geometry without requiring

calibrated cameras

  • Archival videos (already have the pictures)
  • Photos from multiple unrelated users
  • Dynamic camera system
  • Main idea:
  • Estimate epipolar geometry from a (redundant) set of

point correspondences between two uncalibrated cameras

slide-23
SLIDE 23

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

From before: Projection matrix

  • This can be rewritten as a

matrix product using homogeneous coordinates:

int

/ / 1

x x y y

f s

  • f

s

    = −       K

11 12 13 1 21 22 23 2 31 32 33 3 ext

r r r r r r r r r

Τ Τ Τ

−     = −     −   R T Φ R T R T

int

1

w im w im ext w

X wx Y wy Z w           =             K Φ

where: Note: Invertible, scale x and y, assumes no skew

slide-24
SLIDE 24

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

From before: Projection matrix

  • This can be rewritten as a

matrix product using homogeneous coordinates:

1

w im w im int ext w

X wx Y wy Z w           =             K Φ

im int c

= p K p

im int ext w

= p K Φ P

c

p

slide-25
SLIDE 25

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Uncalibrated case

1 , , c left int,left im left −

= p K p

1 , , c right int,right im right −

= p K p

Internal calibration matrices, one per camera im int c

= p K p

So, for two cameras (left and right): For a given camera:

slide-26
SLIDE 26

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

, ,

=

Τ left c right c

Ep p

From before, the essential matrix E.

( ) ( )

1 1 , , int,right im right int,left im left Τ − −

= K p E K p

( )

1 1 , ,

( )

im right int,right int,left im left T Τ − −

= p K EK p

, ,

=

Τ left im right im

Fp p

“Fundamental matrix”

1 , , c left int,left im left −

= p K p

1 , , c right int,right im right −

= p K p

F

Uncalibrated case

'

T

= p Fp

  • r
slide-27
SLIDE 27

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Properties of the Fundamental Matrix

  • is the epipolar line associated with p’
  • is the epipolar line associated with p
  • Epipoles found by Fp’ = 0 and FTp = 0
  • You’ll see more one these on the problem set to explain
  • F is singular (mapping from 2-D point to 1-D

family so rank 2 – more later)

T

'

T

= p Fp

= ′ l Fp

T

′ = l F p

slide-28
SLIDE 28

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Fundamental matrix

  • Relates pixel coordinates in the two views
  • More general form than essential matrix: we remove need

to know intrinsic parameters

  • If we estimate fundamental matrix from correspondences

in pixel coordinates, can reconstruct epipolar geometry without intrinsic or extrinsic parameters.

slide-29
SLIDE 29

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Different Example: forward motion

e e’

courtesy of Andrew Zisserman

slide-30
SLIDE 30

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Computing F from correspondences

Each point correspondence generates one constraint on F Collect n of these constraints Solve for f , vector of parameters.

, ,

=

Τ left im right im

Fp p

slide-31
SLIDE 31

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

The (in)famous “eight-point algorithm”

  • In principal can solve with 8 points.
  • Better with more – yields homogeneous linear least-squares:
  • Find unit norm vector F yielding smallest residual
  • Remember SVD or substitute a 1?
  • What happens when there is noise?
slide-32
SLIDE 32

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Doing the obvious thing

slide-33
SLIDE 33

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Rank of F

  • Assume we know the

homography Hπ that maps from Left to Right (Full 3x3)

  • Let line l’ be the epiloar line

corresponding to p – goes through epipole e’

  • So:
  • Rank of F is rank of [e’]x = 2

'

π

= p H p

' ' '] ' [

π π ×

′ = × = = = × p e H p e H e p l F p

slide-34
SLIDE 34

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Fix the linear solution

  • Use SVD or other method to do linear computation for F
  • Decompose F using SVD (not the same SVD):
  • Set the last singular value to zero:
  • Estimate new F from the new

T

UDV = F

ˆ r r D s D s t         = ⇒ =              

ˆ ˆ

T

UDV = F

ˆ D

slide-35
SLIDE 35

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

That’s better…

slide-36
SLIDE 36

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Stereo image rectification

slide-37
SLIDE 37

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Stereo image rectification

  • Reproject image planes onto a common

plane parallel to the line between optical centers

  • Pixel motion is horizontal after this transformation
  • Two homographies (3x3 transform), one for each input

image reprojection

  • C. Loop and Z. Zhang. Computing Rectifying Homographies for Stereo
  • Vision. IEEE Conf. Computer Vision and Pattern Recognition, 1999.
slide-38
SLIDE 38

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Rectification Example

  • C. Loop and Z. Zhang,

Computing Rectifying Homographies for Stereo Vision, IEEE Conf. Computer Vision and Pattern Recognition, 1999.

slide-39
SLIDE 39

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Some example cool applications…

slide-40
SLIDE 40

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Photo synth

Noah Snavely, Steven M. Seitz, Richard Szeliski, "Photo tourism: Exploring photo collections in 3D," SIGGRAPH 2006 http://photosynth.net/

slide-41
SLIDE 41

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Photosynth.net

Based on Photo Tourism by Noah Snavely, Steve Seitz, and Rick Szeliski

slide-42
SLIDE 42

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

3D from multiple images

Building Rome in a Day: Agarwal et al. 2009

slide-43
SLIDE 43

Two Views Part 2: Essential and Fundamental Matrices CS 4495 Computer Vision – A. Bobick

Summary

  • For 2-views, there is a geometric relationship that define

the relations between rays in one view to rays in the other

  • Calibrated – Essential matrix
  • Uncalibrated – Fundamental matrix.
  • This relation can be estimated from point

correspondences – both in calibrated cases and uncalibrated.

  • Extensions allow combining multiple views to get more

geometric information about scenes

  • SLAM (simultaneous localization and mapping) – you’ll hear about

this (I hope!)