68
3D Computer Vision II Two View Geometry Part 3 – Fundamental Matrix Computation Nassir Navab based on a course given at UNC by Marc Pollefeys & the book “Multiple View Geometry” by Hartley & Zisserman November 09, 2010

3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

3D Computer Vision II

Two View Geometry Part 3 – Fundamental Matrix Computation!

Nassir Navab!based on a course given at UNC by Marc Pollefeys & the book “Multiple View Geometry” by Hartley & Zisserman!

!

!November 09, 2010!

Page 2: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Outline – Two-View Geometry"

•  Epipolar Geometry!•  3D Reconstruction!•  Fundamental Matrix Computation!

2!3D Computer Vision II - Two View Geometry!

!!

Page 3: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

(i)   Correspondence geometry: Given an image point x in the first image, how does this constrain the position of the corresponding point xʼ in the second image?!

(ii) "Camera geometry (motion): Given a set of corresponding image points {xi ↔xʼi}, i=1,…,n, what are the cameras P and Pʼ for the two views?!

(iii) "Scene geometry (structure): Given corresponding image points xi ↔xʼi and cameras P, Pʼ, what is the position of (their pre-image) X in space?!

Reminder – Three Questions"

3!3D Computer Vision II - Two View Geometry!

Page 4: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Algebraic representation of Epipolar Geometry: !

l'x!We will see that mapping is (singular) correlation (i.e. projective mapping from points to lines) represented by the fundamental matrix F.

The Fundamental Matrix F"

4!3D Computer Vision II - Two View Geometry!

Page 5: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

•  Line joining two points!The line through two points and is ! x][x'x'[x]x'xl xx −==×=x x'

Points From Lines and Vice-versa"

llll xx ]'['][l'lx −==×=

•  Intersections of lines !The intersection of two lines and is !l l'

Example!

1=x

1=y

•  Anti-symmetric Matrix !

⎥⎥⎥

⎢⎢⎢

=

00

0][

12

13

23

llllll

l x

5!3D Computer Vision II - Two View Geometry!

Page 6: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

xHx' π=

x'e'l' ×= [ ] FxxHe' π == ×mapping from 2-D to 1-D family (rank 2)

The Fundamental Matrix F – Geometric Derivation"

6!3D Computer Vision II - Two View Geometry!

Page 7: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Algebraic derivation:

( ) xλPλ)C1(λX ++−= ( )IPP =+

[ ] +×= PP'e'F

xPP'CP'l +×=

(note: doesnʼt work for C=Cʼ ⇒ F=0)

xP+( )λX

The Fundamental Matrix F"

7!3D Computer Vision II - Two View Geometry!

Page 8: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Correspondence condition:

0Fxx'T =

!The fundamental matrix satisfies the condition that for any pair of corresponding points x↔xʼ in the two images:!

( )0l'x'T =

The Fundamental Matrix F"

8!3D Computer Vision II - Two View Geometry!

Page 9: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

F is the unique 3x3 rank 2 matrix that satisfies xʼTFx=0 for all x↔xʼ.

(i)   Transpose: if F is fundamental matrix for (P,Pʼ), then FT is fundamental matrix for (Pʼ,P)!

(ii)   Epipolar lines: lʼ=Fx & l=FTxʼ!(iii)   Epipoles: on all epipolar lines, thus eʼTFx=0, ∀x

⇒eʼTF=0, similarly Fe=0!(iv)  F has 7 d.o.f. , i.e. 3x3-1(homogeneous)-1(rank2)!(v)  F is a correlation, projective mapping from a point x to a

line lʼ=Fx (not a proper correlation, i.e. not invertible)!

The Fundamental Matrix F"

9!3D Computer Vision II - Two View Geometry!

Page 10: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

C1!

C2!

l2!

π

l1!

e1!

e2!0m m 1T2 =F

Fundamental matrix (3x3 rank 2 matrix)

Underlying structure in set of matches for rigid scenes

l2!

C1! m1!L1!

m2!

L2!

M!

C2!

m1!

m2!

C1!

C2!

l2!

l1!

e1!

e2!

m1!L1!

m2!

L2!

M!

l2 lT1

Epipolar Geometry"

10!3D Computer Vision II - Two View Geometry!

Page 11: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

C1!

C2!

l2!

π

l1!

e1!

e2!l2!

C1! m1!L1!

m2!

L2!

M!

C2!

m1!

m2!

C1!

C2!

l2!

l1!

e1!

e2!

m1!L1!

m2!

L2!

M!

[ ] 111 xel ×=

1T1 lPπ =

0x][ePPx 1x1T1

T2

T2 =+

0lx 2T2 =

1T1

T22 lPPl +=

Epipolar Geometry"

Page 12: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

1.  Computable from corresponding points 2.  Simplifies matching 3.  Allows to detect wrong matches 4.  Related to calibration

Canonical representation:!

]λe'|ve'F][[e' P'0]|[IP T+== ×

Epipolar Geometry"

12!3D Computer Vision II - Two View Geometry!

Page 13: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

0Fxx'T =

... separate knowns from unknowns:!

0'''''' 333231232221131211 =++++++++ fyfxffyyfyxfyfxyfxxfx

[ ][ ] 0,,,,,,,,1,,,',',',',',' T333231232221131211 =fffffffffyxyyyxyxyxxx

(data)! (unknowns)!(linear)!

Epipolar Geometry – Basic Equations"

13!3D Computer Vision II - Two View Geometry!

Page 14: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

0Af =

0f1''''''

1'''''' 111111111111=

⎥⎥

⎢⎢

nnnnnnnnnnnn yxyyyxyxyxxx

yxyyyxyxyxxx

Epipolar Geometry – Basic Equations"

14!3D Computer Vision II - Two View Geometry!

Page 15: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

0Fe'T = 0Fe = 0detF = 2Frank =

T333

T222

T111

T

3

2

1VσUVσUVσUV

σσ

σUF ++=

⎥⎥

⎢⎢

⎡=

SVD from linearly computed F matrix (rank 3)!

T222

T111

T2

1VσUVσUV

σUF' +=

⎥⎥

⎢⎢

⎡=

FF'-FminCompute closest rank-2 approximation !

The Singularity Constraint"

15!3D Computer Vision II - Two View Geometry!

Page 16: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Non singular F" Forcing singularity using the SVD method"

The Singularity Constraint"

16!3D Computer Vision II - Two View Geometry!

Page 17: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

0f1''''''

1''''''

777777777777

111111111111=

⎥⎥

⎢⎢

yxyyyxyxyxxx

yxyyyxyxyxxx

( ) T9x9717x9 V0,0,σ,...,σdiagUA =

9x298 0]VA[V =⇒

1...70,)xλFF(x 21T =∀=+ʹ′ iii

One parameter family of solutions!

But F1+λF2 not automatically rank 2!

The Minimum Case – 7 Point Correspondences"

17!3D Computer Vision II - Two View Geometry!

Page 18: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

F1! F2!F!

σ3!

F7pts!

0λλλ)λFFdet( 012

23

321 =+++=+ aaaa

(obtain 1 or 3 solutions)!

(cubic equation)!

One or three solutions (only real solutions are acceptable)!

The Minimum Case – Impose Rank 2"

18!3D Computer Vision II - Two View Geometry!

Page 19: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

0

1´´´´´´

1´´´´´´1´´´´´´

33

32

31

23

22

21

13

12

11

222222222222

111111111111

=

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥

⎢⎢⎢⎢

fffffffff

yxyyyyxxxyxx

yxyyyyxxxyxxyxyyyyxxxyxx

nnnnnnnnnnnn

The 8-Point Algorithm"

19!3D Computer Vision II - Two View Geometry!

Page 20: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

0

1´´´´´´

1´´´´´´1´´´´´´

33

32

31

23

22

21

13

12

11

222222222222

111111111111

=

⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥

⎢⎢⎢⎢

fffffffff

yxyyyyxxxyxx

yxyyyyxxxyxxyxyyyyxxxyxx

nnnnnnnnnnnn

~10000 ~10000 ~10000 ~10000 ~100 ~100 1 ~100 ~100

!"Orders of magnitude difference between columns of data matrix → least-squares yields poor results

The Unnormalized 8-Point Algorithm"

20!3D Computer Vision II - Two View Geometry!

Page 21: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

The Normalized 8-Point Algorithm"

Transform image to ~[-1,1]x[-1,1]!

(0,0)

(700,500)

(700,0)

(0,500)

(1,-1)

(0,0)

(1,1) (-1,1)

(-1,-1)

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

1

15002

107002

Least squares yields good results (Hartley, PAMI´97)!

21!3D Computer Vision II - Two View Geometry!

Page 22: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Possible to iteratively minimize algebraic distance!subject to det F=0 (see book if interested).

!

F = M[e]x " f = Em

E =

[e]x 0 00 [e]x 00 0 [e]x

#

$

% % %

&

'

( ( (

AEm

Algebraic Minimization"

!

Em =1

where

Minimize subject to

22!3D Computer Vision II - Two View Geometry!

Page 23: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

!

Geometric Distance"

•  Gold standard!•  Sampson error!•  Symmetric epipolar distance!

23!3D Computer Vision II - Two View Geometry!

Page 24: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Maximum Likelihood Estimation

( ) ( )∑ +i

iiii dd 22 'x̂,x'x̂,x

(= least-squares for Gaussian noise)

0x̂F'x̂ subject to T =

iXt],|[MP'0],|[IP ==Parameterize:!

Initialize: normalized 8-point, (P,P‘) from F, reconstruct Xi v!

iiii XP'x̂,PXx̂ ==Minimize cost using Levenberg-Marquardt!(preferably sparse LM, see book)!

(overparametrized)!

Gold Standard"

24!3D Computer Vision II - Two View Geometry!

Page 25: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Alternative, minimal parametrization (with a=1)!

(note (x,y,1) and (x‘,y‘,1) are epipoles)!

problems: !•  a=0! → pick largest of a,b,c,d to fix!

•  epipole at infinity! → pick largest of x,y,w and of xʼ,yʼ,wʼ!

4x3x3=36 parametrizations!!

reparametrize at every iteration, to be sure!

Gold Standard"

')(')( ''''

33

33

ydycxxbyaxFwhereFdybxcyaxdycxdcbyaxba

+++=

⎥⎥⎥

⎢⎢⎢

−−−−

−−

−−

=F

25!3D Computer Vision II - Two View Geometry!

Page 26: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

( )∑− ee 1TT JJ ∑ T

T

JJee (one eq./point ⇒ JJT scalar)!

0Fxx'T ==∑e⎥⎥⎦

⎢⎢⎣

⎡=

001

Fx'Tixe

( ) ( ) ( ) ( )2221

22

T21

TT FxFxFx'Fx'JJ +++=

∑ T

T

JJee

( ) ( ) ( ) ( )∑+++ 2

221

22

T21

T

T

FxFxFx'Fx'Fxx'

(problem if some x is located at epipole)!

advantage: no subsidiary variables required!

First-order Geometric Error (Sampson Error)"

26!3D Computer Vision II - Two View Geometry!

Page 27: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

( ) ( ) ( ) ( )∑ ⎟⎟

⎜⎜

++

+= 2

221

22

T21

T

T

FxFx1

Fx'Fx'1Fxx'

( ) ( )∑ +i

iiii dFd 2T2 x'F,xx,x'

Symmetric Epipolar Error"

27!3D Computer Vision II - Two View Geometry!

Page 28: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Some Experiments"

28!3D Computer Vision II - Two View Geometry!

Page 29: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Some Experiments"

29!3D Computer Vision II - Two View Geometry!

Page 30: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Some Experiments"

30!3D Computer Vision II - Two View Geometry!

Page 31: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

( ) ( )∑ +i

iiii dFd 2T2 x'F,xx,x'

(for all points!)!

Residual error:!

Some Experiments"

31!3D Computer Vision II - Two View Geometry!

Page 32: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Recommendations"

•  Do not use unnormalized algorithms!•  Quick and easy to implement: 8-point normalized!•  Better: enforce rank-2 constraint during minimization!•  Best: Maximum Likelihood Estimation !

(minimal parameterization, sparse implementation)!

32!3D Computer Vision II - Two View Geometry!

Page 33: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Special Case"

Enforce constraints for optimal results:"•  Pure translation (2dof):!

•  Planar motion (6dof), !•  Calibrated case (5dof)!

×= ][e'F

33!3D Computer Vision II - Two View Geometry!

Page 34: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

What happens to an epipolar line if there is noise?!

Monte Carlo!

n=10! n=15! n=25! n=50!

The Envelope of Epipolar Lines"

34!3D Computer Vision II - Two View Geometry!

Page 35: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Lines give no constraint for two view geometry!(but will for three and more views)!!!!Curves and surfaces yield some constraints related to tangency!

Other Entities"

35!3D Computer Vision II - Two View Geometry!

Page 36: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

(i)  Interest points!(ii)  Putative correspondences!(iii)  RANSAC !(iv) !Non-linear re-estimation of F!(v)  Guided matching!!Repeat (iv) and (v) until stable!

Automatic Computation of F"

36!3D Computer Vision II - Two View Geometry!

Page 37: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Feature Points"

•  Extract feature points to relate images!

•  Required properties:!–  Well-defined !! ! !(i.e. neigboring points should all be different)!

–  Stable across views!(i.e. same 3D point should be extracted as feature !for neighboring viewpoints)!

37!3D Computer Vision II - Two View Geometry!

Page 38: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

homogeneous!

edge!

corner!

(e.g. Harris & Stephens ‘88; Shi & Tomasi ‘94)!

Find points that differ as much as possible !from all neighboring points!

Feature Points"

38!3D Computer Vision II - Two View Geometry!

Page 39: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Feature Points"

Select strongest features (e.g. 1000/image)!

39!3D Computer Vision II - Two View Geometry!

Page 40: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Feature Matching"

Evaluate NCC for all features with similar coordinates!

Keep mutual best matches!Still many wrong matches!!

( ) [ ] [ ]10101010 ,,´´, e.g. hhww yyxxyx +−×+−∈

? 40!3D Computer Vision II - Two View Geometry!

Page 41: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

0.96 -0.40 -0.16 -0.39 0.19

-0.05 0.75 -0.47 0.51 0.72

-0.18 -0.39 0.73 0.15 -0.75

-0.27 0.49 0.16 0.79 0.21

0.08 0.50 -0.45 0.28 0.99

1 5

2 4

3

1 5

2 4

3

Gives satisfying results !for small image motions!

Feature Example"

41!3D Computer Vision II - Two View Geometry!

Page 42: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Wide-baseline Matching"

•  Requirement to cope with larger variations between images!

–  Translation, rotation, scaling!–  Foreshortening!

–  Non-diffuse reflections!–  Illumination!

} geometric !transformations!

photometric !changes!}

42!3D Computer Vision II - Two View Geometry!

Page 43: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Wide-baseline Matching"

!Wide baseline matching for two different region types!

(Tuytelaars and Van Gool BMVC 2000)!

43!3D Computer Vision II - Two View Geometry!

Page 44: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

RANSAC"Step 1. Extract features!Step 2. Compute a set of potential matches!Step 3. do!

! !Step 3.1 select minimal sample (i.e. 7 matches)!! !Step 3.2 compute solution(s) for F!! !Step 3.3 determine inliers!

!until Γ(#inliers,#samples)<95% !

( ) samples#7)1(1matches#inliers#−−=Γ

#inliers 90% 80% 70% 60% 50% #samples 5 13 35 106 382

Step 4. Compute F based on all inliers!Step 5. Look for additional matches!Step 6. Refine F based on all correct matches!

generate hypothesis

verify hypothesis

44!3D Computer Vision II - Two View Geometry!

Page 45: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Restrict search range to neighborhood of epipolar line ! (±1.5 pixels)! Relax disparity restriction (along epipolar line)!

Finding More Matches"

45!3D Computer Vision II - Two View Geometry!

Page 46: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Degenerate Cases"

•  Degenerate cases!–  Planar scene!–  Pure rotation!

•  No unique solution!–  Remaining DOF filled by noise!–  Use simpler model (e.g. homography)!

•  Model selection (Torr et al., ICCV´98, Kanatani, Akaike)!–  Compare H and F according to expected residual error

(compensate for model complexity)!

46!3D Computer Vision II - Two View Geometry!

Page 47: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

More Problems"

•  Absence of sufficient features (no texture)!•  Repeated structure ambiguity !

(Schaffalitzky and Zisserman, BMVC‘98)

!• Robust matcher also finds support for wrong hypothesis!•  Solution: detect repetition !

47!3D Computer Vision II - Two View Geometry!

Page 48: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Two-view Geometry"

Geometric relations between two views are fully !described by recovered 3x3 matrix F."

48!3D Computer Vision II - Two View Geometry!

Page 49: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Simplify stereo matching by warping the images.!

Apply projective transformation so that epipolar lines!correspond to horizontal scanlines!

e!e!

map epipole e to infinity (1,0,0)!try to minimize image distortion!problem when epipole in (or close to) the image!

He001=

⎥⎥⎦

⎢⎢⎣

Image Rectification"

49!3D Computer Vision II - Two View Geometry!

Page 50: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Planar Rectification"

Bring two views !to standard stereo setup!(moves epipole to ∞)!(not possible when in/close to image)!

~ image size!(calibrated)!

Distortion minimization!(uncalibrated)!

(standard approach)!

50!3D Computer Vision II - Two View Geometry!

Page 51: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

51!3D Computer Vision II - Two View Geometry!

Page 52: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

52!

Page 53: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Polar re-parameterization around epipoles!Requires only (oriented) epipolar geometry!Preserve length of epipolar lines!Choose Δθ so that no pixels are compressed!

original image! rectified image!

Polar Rectification"(Pollefeys et al. ICCVʼ99)!

Works for all relative motions!Guarantees minimal image size!

53!3D Computer Vision II - Two View Geometry!

Page 54: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Polar Rectification :: Example"

54!3D Computer Vision II - Two View Geometry!

Page 55: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Polar Rectification :: Example"

55!3D Computer Vision II - Two View Geometry!

Page 56: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Example :: Béguinage of Leuven"

Does not work with standard !Homography-based approaches!

56!3D Computer Vision II - Two View Geometry!

Page 57: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Example :: Béguinage of Leuven"

57!3D Computer Vision II - Two View Geometry!

Page 58: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Stereo Matching"

•  attempt to match every pixel!•  use additional constraints!

58!3D Computer Vision II - Two View Geometry!

Page 59: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Exploiting Motion and Scene Constraints"

•  Ordering constraint!•  Uniqueness constraint!•  Disparity limit!•  Disparity continuity constraint"

•  Epipolar constraint (through rectification) "

59!3D Computer Vision II - Two View Geometry!

Page 60: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Ordering Constraint"

1 2 3 4,5 6 1 2,3 4 5 6

2 1 3 4,5 6 1

2,3

4 5

6

surface slice! surface as a path!

occlusion right!

occlusion left!

60!3D Computer Vision II - Two View Geometry!

Page 61: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Uniqueness Constraint"

•  In an image pair each pixel has at most one corresponding pixel!–  In general one corresponding pixel!–  In case of occlusion there is none!

61!3D Computer Vision II - Two View Geometry!

Page 62: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Disparity Constraint"

surface slice! surface as a path!

bounding box!

use reconsructed features !to determine bounding box !

constant!disparity!surfaces!

62!3D Computer Vision II - Two View Geometry!

Page 63: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Disparity Continuity Constraint"

•  Assume piecewise continuous surface!⇒  piecewise continuous disparity!

–  In general disparity changes continuously!–  discontinuities at occluding boundaries!

63!3D Computer Vision II - Two View Geometry!

Page 64: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Stereo Matching"

Optimal path!(dynamic programming )!

Similarity measure!(SSD or NCC)!

Constraints!•  epipolar!•  ordering!•  uniqueness!•  disparity limit!•  disparity gradient limit!

Trade-off!•  Matching cost (data)!•  Discontinuities (prior)!

(Cox et al. CVGIP’96; Koch’96; Falkenhagen´97;! Van Meerbergen,Vergauwen,Pollefeys,VanGool IJCV‘02)!

64!3D Computer Vision II - Two View Geometry!

Page 65: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Disparity Map"

image I(x,y)! image I´(x´,y´)!Disparity map D(x,y)!

(x´,y´)=(x+D(x,y),y)!

65!3D Computer Vision II - Two View Geometry!

Page 66: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Hierarchical Stereo Matching"D

owns

ampl

ing

(G

auss

ian

pyra

mid

)

Dis

pari

ty p

ropa

gati

on

Allows faster computation!

Deals with large disparity ranges!

(Falkenhagen´97;Van Meerbergen,Vergauwen,Pollefeys,VanGool IJCV‘02)!

66!3D Computer Vision II - Two View Geometry!

Page 67: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Example: Reconstruct Image from Neighboring Images"

67!3D Computer Vision II - Two View Geometry!

Page 68: 3D Computer Vision II Two View Geometrycampar.in.tum.de/twiki/pub/Chair/TeachingWs10Cv2/3D_CV2... · 2010-11-10 · 3D Computer Vision II Two View Geometry Part 3 – Fundamental

Multi-view Depth Fusion"

•  Compute depth for every pixel of reference image!

–  Triangulation!–  Use multiple views!–  Up- and down sequence!–  Use Kalman filter!

(Koch, Pollefeys and Van Gool. ECCV‘98)!

Allows to compute robust texture!68!3D Computer Vision II - Two View Geometry!