reconstruction from multiple viewsramani/cmsc828d/lecture28.pdf · projective reconstruction...

29
1 Reconstruction from Multiple Views Daniel DeMenthon

Upload: others

Post on 05-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

1

Reconstruction from Multiple Views

Daniel DeMenthon

Page 2: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

2

3D Reconstruction from Image Pairs

• Find interest points• Match interest points • Compute fundamental matrix F• Compute camera matrices P and P’ from F• For each matching image points x and x’,

compute point X in scene

Page 3: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

3

Computing Scene Point from Two Matching Image Points

• We now have computed P and P’ from F• Problem: find X from x and x’• x = P X, x’ = P’ X. Combine into a form

A X = 0• Solve A X = 0 using SVD and picking the

singular vector corresponding to the smallest singular value§ Note: Nonlinear methods generally give better

results

Page 4: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

4

Computing Scene Point from Two Matching Image Points (Details)

0 X)(P x XP x =×⇔=

=

=XPXPXP

XPPP

XPT3

T2

T1

T3

T2

T1

=

1yx

x

0)()(

0)()(

0)()(

=−

=−

=−

XPXP

XPXP

XPXP

T1

T2

T1

T3

T2

T3

yx

x

y

Linear combination of other 2 equations

Page 5: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

5

Computing Scene Point from Two Matching Image Points (End)

• Homogeneous system A X = 0 is

• X is the last column of V in the SVD of A, A = U D VT

0

''

=

X

P'-PP'-PP-PP-P

T2

T3

T1

T3

T2

T3

T1

T3

yxyx

Page 6: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

6

Projective Reconstruction Theorem• Assume we determine matching points xi and

x’i. Then we can compute a unique fundamental matrix F

• The recovered camera matrices are not unique: (P1, P’1), (P2, P’2), etc.

• The reconstruction is not unique: X1i, X2i, etc. • There exists a projective transformation H such

that X2i = H X1i, P2 = P1 H-1, P’2 = P’1 H-1

Page 7: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

7

Projective Reconstruction Theorem (Details)• There exists a projective transformation H such

that X2i = H X1i, P2 = P1 H-1, P’2 = P’1 H-1

C1 C’1

X1

e e’

x x’

Image

C2 C’2

X2

e e’

x x’

Same Image

xx Px H H P XH P XP 111-1

12-1

122 ====

Page 8: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

8

Projective Reconstruction Theorem(Consequences)

• We can compute a projective reconstruction of a scene from 2 views based on image correspondences alone

• We don’t have to know anything about the calibration or poses of the cameras

• The true reconstruction is within a projective transformation H of the projective reconstruction: X2i = H X1i

Page 9: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

9

Reconstruction Ambiguities• If the reconstruction is derived from real images,

there is a true reconstruction that can produce the actual points Xi of the scene

• Our reconstruction may differ from the actual one§ If the cameras are calibrated but their relative pose is

unknown, then angles between rays are the true angles, and the reconstruction is correct within a similarity (we cannot get the scale)

• Euclidean or metric reconstruction

§ If we don’t use calibration, then we get a projective reconstruction

Page 10: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

10

Rectifying Projective Reconstruction to Metric

• Compute homography H such that XEi = H Xifor five or more ground control points XEi with known Euclidean positions§ H is a 4 x 4 homogeneous matrix

• Then the metric reconstruction is

iMi-1

M-1

M XHXH P'P'H PP === ,,

Page 11: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

11

Results using 5 points

Page 12: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

12

Stratified Reconstruction

• Begin with a projective reconstruction• Refine it to an affine reconstruction§ Parallel lines are parallel; ratios along parallel

lines are correct§ Reconstructed scene is then an affine

transformation of the actual scene

• Then refine it to a metric reconstruction§ Angles and ratios are correct§ Reconstructed scene is then a scaled version of

actual scene

Page 13: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

13

From Projective to Affine Reconstruction• Find 3 intersections of sets of lines in the

scene that are supposed to be parallel§ These 3 points define a plane π

• Find a transformation H that maps the plane π to the plane at infinity (0, 0, 0, 1)T: § This plane contains all points at infinity:

(0, 0, 0, 1) (x, y, z, 0)T = 0§ H-T π = (0, 0, 0, 1)T , or HT(0, 0, 0, 1)T = π

=⇒

=

Tp0 | I

H

4

3

2

1

4

3

2

1

1000

000100010001

ππππ

ππππ

Apply H to scene points,and to cameras P and P’

Page 14: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

14

Example of Affine Reconstruction

Page 15: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

15

From Affine to Metric Reconstruction

• Use constraints from scene orthogonal lines• Use constraints arising from having the

same camera in both images

Page 16: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

16

Direct Metric Reconstructionusing Camera Calibration

• Find calibration matrices K and K’ using 3 vanishing points for orthogonal scene lines§ See homework

• Normalize image points• Compute fundamental matrix using

matched normalized points: we get the essential matrix E

• Select P=[I | 0] and P’=[R |T]. Then • Find T and R using SVD of E• From P and P’, reconstruct scene points

R[T] E ×=

Page 17: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

17

Reconstruction from N Views

• Projective or affine reconstruction from a possibly large set of images

• Problem§ Set of 3D points Xj

§ Set of cameras Pi

§ For each camera Pi , set of image points xji

§ Find 3D points Xj and cameras Pi such that Pi Xj = xj

i

Page 18: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

18

Bundle Adjustment

• Solve following minimization problem§ Find Pi and Xj that minimize

§ Levenberg-Marquardt algorithm§ Problems:

• Many parameters: 11 per camera, 3 per 3D point• Matrices (11 m + 3 n) x (11 m + 3 n) • Good initialization required

• Mainly used as final adjustment step of the bundle of rays

2),(∑ji,

ijj

i x XPd

Page 19: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

19

Initial Solutions: Affine Factorization Algorithm

• Tomasi and Kanade (1992)• Affine reconstruction• Affine camera

• Inhomogeneous coordinates x = M X + T

TM +

=

=

ZYX

yx

ZYX

TmmmTmmm

wvu

11000

2232221

1131211

Page 20: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

20

Affine Factorization

• Minimize• Choose centroid of points as origin of scene

coordinate system• Choose pixel (0, 0) at image of centroid • Then the problem becomes:

Minimize§ Note: This requires the same points to be

visible in all views

2))∑ji,

jii

j XM-(x

2))∑ +ji,

ij

iij T X(M-(x

Page 21: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

21

Affine Factorization

• Consider the measurement matrix (one row per image point)

• The projection matrix is

• Minimize

=

mn

m2

m1

2n

22

21

1n

12

11

xxx

xxxxxx

W

LMOMM

LL

[ ]n

m

2

1

XXX

M

MM

W LM 21

ˆ

=

W-W ˆ

Page 22: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

22

Affine Factorization

• Minimize • Find as the SVD of W truncated to rank 3:

• Then M may be chosen as U D and X as VT

• This decomposition is not unique:

• Reconstruction is defined up to a matrix A• Reconstruction is affine• To upgrade to a metric reconstruction, see above

W-W ˆ

T3n3332m V D UW ×××=ˆ

)X(A A)M X MW -1 ˆˆ(ˆˆˆ ==

W

Page 23: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

23

Projective Factorization

• W has rank 4. Assume the wji coefficients known

[ ]n

m

2

1

mn

mn

m2

m2

m1

m1

2n

2n

22

22

21

21

1n

1n

12

12

11

11

XXX

P

PP

x x x

x x xx x x

LM

LMOMM

LL

11

=

www

wwwwww

ij

ij

ij

ij

ij

ij

ij

ij

ijj

iij x' x XPx wyxwwvu ==== )1,,(),,(,

• The wji are unknown, related

to the depths of points in camera coordinates

•We dropped the primes on xji

[ ]n

m

2

1

XXX

P

PP

W LM 11

ˆ

=

T4n4443mn3m V D UW ×××× =ˆ

Page 24: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

24

Projective Factorization

1. Start with an initial estimate of the depths wji

2. From the measurement matrix W, find the nearest rank 4 approximation using the SVD and decompose to find the camera matrices and 3D points

3. Reproject the points into each image to obtain new estimates of the depths and repeat from step 2

Page 25: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

25

Reconstruction from Video Sequences

• Compute interest points in each image• Compute interest point correspondences

between image pairs• Compute fundamental matrix F for each

image pair• Initial reconstruction• Bundle-adjust the cameras and 3D structure

to minimize projection errors

Page 26: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

26

Issues for Videos

• Small baseline between image pairs§ Advantage: having similar images facilitates finding

point correspondences§ Disadvantage: 3D structure is estimated poorly for

each image pair

• Solutions: § Use consecutive images for point correspondences,

and images far apart for 3D structure reconstruction§ Make small batches and combine them by least

square§ Use recursive least square method

Page 27: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

27

Examples of 3D Reconstruction

Page 28: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

28

Examples of 3D Reconstruction

Page 29: Reconstruction from Multiple Viewsramani/cmsc828d/lecture28.pdf · Projective Reconstruction Theorem • Assume we determine matching points x i and x’ i. Then we can compute a

29

References

• Multiple View Geometry in Computer Vision, R. Hartley and A. Zisserman, Cambridge University Press, 2000.

• D. Forsyth and J. Ponce. Computer Vision: A Modern Approach, http://www.cs.berkeley.edu/~daf/book3chaps.html§ Geometry of Multiple Views (Chapter 12)§ Stereopsis (Chapter 13)§ Affine Structure from Motion (Chapter 14)§ Projective Structure from Motion (Chapter 15)