Structure from Motion Computer Vision Jia-Bin Huang, Virginia Tech - - PowerPoint PPT Presentation

โ–ถ
structure from motion
SMART_READER_LITE
LIVE PREVIEW

Structure from Motion Computer Vision Jia-Bin Huang, Virginia Tech - - PowerPoint PPT Presentation

Structure from Motion Computer Vision Jia-Bin Huang, Virginia Tech Many slides from S. Seitz, N Snavely, and D. Hoiem Administrative stuffs HW 3 due 11:55 PM, Oct 17 (Wed) Submit your alignment results! [Link] HW 2 will be out this


slide-1
SLIDE 1

Structure from Motion

Computer Vision Jia-Bin Huang, Virginia Tech

Many slides from S. Seitz, N Snavely, and D. Hoiem

slide-2
SLIDE 2

Administrative stuffs

  • HW 3 due 11:55 PM, Oct 17 (Wed)
  • Submit your alignment results! [Link]
  • HW 2 will be out this week
slide-3
SLIDE 3

Perspective and 3D Geometry

  • Projective geometry and camera models
  • Vanishing points/lines
  • x = ๐‹ ๐’ ๐ฎ ๐˜
  • Single-view metrology and camera calibration
  • Calibration using known 3D object or vanishing points
  • Measuring size using perspective cues
  • Photo stitching
  • Homography relates rotating cameras ๐ฒโ€ฒ = ๐ˆ๐ฒ
  • Recover homography using RANSAC + normalized DLT
  • Epipolar Geometry and Stereo Vision
  • Fundamental/essential matrix relates two cameras ๐ฒโ€ฒ๐†๐ฒ = ๐Ÿ
  • Recover ๐† using RANSAC + normalized 8-point algorithm,

enforce rank 2 using SVD

  • Structure from motion (this class)
  • How can we recover 3D points from multiple images?
slide-4
SLIDE 4

Recap: Epipoles

  • Point x in the left image corresponds to epipolar line lโ€™ in right

image

  • Epipolar line passes through the epipole

(the intersection of the camerasโ€™ baseline with the image plane

slide-5
SLIDE 5

Recap: Fundamental Matrix

  • Fundamental matrix maps from a point in one

image to a line in the other

  • If x and xโ€™ correspond to the same 3d point X:
slide-6
SLIDE 6

Recap: Automatic Estimation of F

8-Point Algorithm for Recovering F

  • Correspondence Relation
  • 1. Normalize image coordinates
  • 2. RANSAC with 8 points
  • Randomly sample 8 points
  • Compute F via least squares
  • Enforce

by SVD

  • Repeat and choose F with most inliers
  • 3. De-normalize:

Assume we have matched points x xโ€™ with outliers

Tx x ๏€ฝ ~ x T x ๏‚ข ๏‚ข ๏€ฝ ๏‚ข ~

T F T F ~

T

๏‚ข ๏€ฝ

๏€จ ๏€ฉ

~ det ๏€ฝ F

๏€ฝ ๏‚ข Fx x T

slide-7
SLIDE 7

This class: Structure from Motion

  • Projective structure from motion
  • Affine structure from motion
  • HW 3
  • Fundamental matrix
  • Affine structure from motion
  • Multi-view stereo (optional)
slide-8
SLIDE 8

Structure[หˆstrษ™k(t)SHษ™r]:

3D Point Cloud of the Scene

Motion [หˆmลSH(ษ™)n]:

Camera Location and Orientation

Structure from Motion (SfM)

Get the Point Cloud from Moving Cameras

slide-9
SLIDE 9

SfM Applications โ€“ 3D Modeling

http://www.3dcadbrowser.com/download.aspx?3dmodel=40454

slide-10
SLIDE 10

SfM Applications โ€“ Surveying cultural heritage structure analysis

Guidi et al. High-accuracy 3D modeling of cultural heritage, 2004

slide-11
SLIDE 11

SfM Applications โ€“ Robot navigation and mapmaking

https://www.youtube.com/watch?v=1HhOmF22oYA

slide-12
SLIDE 12

SfM Applications โ€“ Visual effect (matchmove)

https://www.youtube.com/watch?v=bK6vCPcFkfk

slide-13
SLIDE 13

Images ๏ƒ  Points: Structure from Motion Points ๏ƒ  More points: Multiple View Stereo Points ๏ƒ  Meshes: Model Fitting Meshes ๏ƒ  Models: Texture Mapping Images ๏ƒ  Models: Image-based Modeling

= + +

Steps

+ =

Slide credit: J. Xiao

slide-14
SLIDE 14

= + +

Steps

+ =

Images ๏ƒ  Points: Structure from Motion Points ๏ƒ  More points: Multiple View Stereo Points ๏ƒ  Meshes: Model Fitting Meshes ๏ƒ  Models: Texture Mapping Images ๏ƒ  Models: Image-based Modeling

Slide credit: J. Xiao

slide-15
SLIDE 15

Images ๏ƒ  Points: Structure from Motion Points ๏ƒ  More points: Multiple View Stereo Points ๏ƒ  Meshes: Model Fitting Meshes ๏ƒ  Models: Texture Mapping Images ๏ƒ  Models: Image-based Modeling

+ + +

Steps

=

+ =

Slide credit: J. Xiao

slide-16
SLIDE 16

Steps

Images ๏ƒ  Points: Structure from Motion Points ๏ƒ  More points: Multiple View Stereo Points ๏ƒ  Meshes: Model Fitting Meshes ๏ƒ  Models: Texture Mapping Images ๏ƒ  Models: Image-based Modeling

+ =

Slide credit: J. Xiao

slide-17
SLIDE 17

Steps

Images ๏ƒ  Points: Structure from Motion Points ๏ƒ  More points: Multiple View Stereo Points ๏ƒ  Meshes: Model Fitting Meshes ๏ƒ  Models: Texture Mapping Images ๏ƒ  Models: Image-based Modeling

+ =

Slide credit: J. Xiao

slide-18
SLIDE 18

Steps

Images ๏ƒ  Points: Structure from Motion Points ๏ƒ  More points: Multiple View Stereo Points ๏ƒ  Meshes: Model Fitting Meshes ๏ƒ  Models: Texture Mapping Images ๏ƒ  Models: Image-based Modeling

+ =

Example: https://photosynth.net/

Slide credit: J. Xiao

slide-19
SLIDE 19

Triangulation: Linear Solution

  • Generally, rays C๏ƒ x and

Cโ€™๏ƒ xโ€™ will not exactly intersect

  • Solve via SVD:

A least squares solution to a system of equations

X

x x'

X P x ๏‚ข ๏€ฝ ๏‚ข PX x ๏€ฝ AX ๏€ฝ ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏‚ข ๏€ญ ๏‚ข ๏‚ข ๏‚ข ๏€ญ ๏‚ข ๏‚ข ๏€ญ ๏€ญ ๏€ฝ

T T T T T T T T

v u v u

2 3 1 3 2 3 1 3

p p p p p p p p A

Further reading: HZ p. 312-313

slide-20
SLIDE 20

Triangulation: Linear Solution

๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏€ฝ 1 v u w x ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏‚ข ๏‚ข ๏€ฝ ๏‚ข 1 v u w x ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏€ฝ

T T T 3 2 1

p p p P ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏‚ข ๏‚ข ๏‚ข ๏€ฝ ๏‚ข

T T T 3 2 1

p p p P

๐ฒ = ๐‘ฅ ๐‘ฃ ๐‘ค 1 = ๐‘ธ๐’€ = ๐’’๐Ÿ

๐‘ผ

๐’’๐Ÿ‘

๐‘ผ

๐’’๐Ÿ’

๐‘ผ

๐’€ = ๐’’๐Ÿ

๐‘ผ๐’€

๐’’๐Ÿ‘

๐‘ผ๐’€

๐’’๐Ÿ’

๐‘ผ๐’€

๐‘ฅ ๐‘ฃ ๐‘ค 1 = ๐‘ฃ๐’’๐Ÿ’

๐‘ผ๐’€

๐‘ค๐’’๐Ÿ’

๐‘ผ๐’€

๐’’๐Ÿ’

๐‘ผ๐’€

= ๐’’๐Ÿ

๐‘ผ๐’€

๐’’๐Ÿ‘

๐‘ผ๐’€

๐’’๐Ÿ’

๐‘ผ๐’€

๐‘ฃ๐’’๐Ÿ’

๐‘ผ๐’€ โˆ’ ๐’’๐Ÿ ๐‘ผ๐’€

= ๐‘ฃ๐’’๐Ÿ’

๐‘ผ โˆ’ ๐’’๐Ÿ ๐‘ผ ๐’€ = ๐Ÿ

๐‘ค๐’’๐Ÿ’

๐‘ผ๐’€ โˆ’ ๐’’๐Ÿ‘ ๐‘ผ๐’€

= ๐‘ค๐’’๐Ÿ’

๐‘ผ โˆ’ ๐’’๐Ÿ‘ ๐‘ผ ๐’€ = ๐Ÿ

๐‘ฃโ€ฒ๐’’โ€ฒ๐Ÿ’

๐‘ผ๐’€ โˆ’ ๐’’โ€ฒ๐Ÿ ๐‘ผ๐’€ = ๐‘ฃโ€ฒ๐’’โ€ฒ๐Ÿ’ ๐‘ผ โˆ’ ๐’’โ€ฒ๐Ÿ ๐‘ผ ๐’€ = ๐Ÿ

๐‘คโ€ฒ๐’’โ€ฒ๐Ÿ’

๐‘ผ๐’€ โˆ’ ๐’’โ€ฒ๐Ÿ‘ ๐‘ผ๐’€ = ๐‘คโ€ฒ๐’’โ€ฒ๐Ÿ’ ๐‘ผ โˆ’ ๐’’โ€ฒ๐Ÿ‘ ๐‘ผ ๐’€ = ๐Ÿ

X P x ๏‚ข ๏€ฝ ๏‚ข PX x ๏€ฝ

slide-21
SLIDE 21

Triangulation: Linear Solution

Given P, Pโ€™, x, xโ€™

  • 1. Precondition points and projection

matrices

  • 2. Create matrix A
  • 3. [U, S, V] = svd(A)

4. X = V(:, end) Pros and Cons

  • Works for any number of

corresponding images

  • Not projectively invariant

๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏€ฝ 1 v u w x ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏‚ข ๏‚ข ๏€ฝ ๏‚ข 1 v u w x ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏€ฝ

T T T 3 2 1

p p p P ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏‚ข ๏€ญ ๏‚ข ๏‚ข ๏‚ข ๏€ญ ๏‚ข ๏‚ข ๏€ญ ๏€ญ ๏€ฝ

T T T T T T T T

v u v u

2 3 1 3 2 3 1 3

p p p p p p p p A ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏‚ข ๏‚ข ๏‚ข ๏€ฝ ๏‚ข

T T T 3 2 1

p p p P

Code: http://www.robots.ox.ac.uk/~vgg/hzbook/code/vgg_multiview/vgg_X_from_xP_lin.m

slide-22
SLIDE 22

Triangulation: Non-linear Solution

  • Minimize projected error while satisfying

Figure source: Robertson and Cipolla (Chpt 13 of Practical Image Processing and Computer Vision)

เท ๐’šโ€ฒ ๐’šโ€ฒ ๐’š เท ๐’š

๐‘‘๐‘๐‘ก๐‘ข ๐’€ = ๐‘’๐‘—๐‘ก๐‘ข ๐’š, เท ๐’š 2 + ๐‘’๐‘—๐‘ก๐‘ข ๐’šโ€ฒ, เท ๐’šโ€ฒ 2

เท ๐’šโ€ฒ๐‘ˆ๐‘ฎเท ๐’š=0

slide-23
SLIDE 23

Triangulation: Non-linear Solution

  • Minimize projected error while satisfying
  • Solution is a 6-degree polynomial of t, minimizing

Further reading: HZ p. 318

เท ๐’šโ€ฒ๐‘ˆ๐‘ฎเท ๐’š=0

๐‘‘๐‘๐‘ก๐‘ข ๐’€ = ๐‘’๐‘—๐‘ก๐‘ข ๐’š, เท ๐’š 2 + ๐‘’๐‘—๐‘ก๐‘ข ๐’šโ€ฒ, เท ๐’šโ€ฒ 2

slide-24
SLIDE 24

Projective structure from motion

  • Given: m images of n fixed 3D points

xij = Pi Xj , i = 1,โ€ฆ , m, j = 1, โ€ฆ , n

  • Problem: estimate m projection matrices Pi and n 3D

points Xj from the mn corresponding 2D points xij

x1j x2j x3j Xj P1 P2 P3 Slides from Lana Lazebnik

slide-25
SLIDE 25

Projective structure from motion

  • Given: m images of n fixed 3D points
  • xij = Pi Xj , i = 1,โ€ฆ , m, j = 1, โ€ฆ , n
  • Problem:
  • Estimate unknown m projection matrices Pi and n 3D points Xj

from the known mn corresponding points xij

  • With no calibration info, cameras and points can only

be recovered up to a 4x4 projective transformation Q:

  • X โ†’ QX, P โ†’ PQ-1
  • We can solve for structure and motion when

2mn >= 11m + 3n โ€“ 15

  • For two cameras, at least 7 points are needed

DoF in Pi DoF in Xj Up to 4x4 projective tform Q

slide-26
SLIDE 26

Sequential structure from motion

  • Initialize motion (calibration) from

two images using fundamental matrix

  • Initialize structure by triangulation
  • For each additional view:
  • Determine projection matrix of new

camera using all the known 3D points that are visible in its image โ€“ calibration/resectioning

cameras points

slide-27
SLIDE 27

Sequential structure from motion

  • Initialize motion from two images

using fundamental matrix

  • Initialize structure by triangulation
  • For each additional view:
  • Determine projection matrix of new

camera using all the known 3D points that are visible in its image โ€“ calibration

  • Refine and extend structure:

compute new 3D points, re-optimize existing points that are also seen by this camera โ€“ triangulation

cameras points

slide-28
SLIDE 28

Sequential structure from motion

  • Initialize motion from two images

using fundamental matrix

  • Initialize structure by triangulation
  • For each additional view:
  • Determine projection matrix of new

camera using all the known 3D points that are visible in its image โ€“ calibration

  • Refine and extend structure:

compute new 3D points, re-

  • ptimize existing points that are also

seen by this camera โ€“ triangulation

  • Refine structure and motion: bundle

adjustment cameras points

slide-29
SLIDE 29

Bundle adjustment

  • Non-linear method for refining structure and motion
  • Minimizing reprojection error

๏€จ ๏€ฉ

2 1 1

, ) , (

๏ƒฅ๏ƒฅ

๏€ฝ ๏€ฝ

๏€ฝ

m i n j j i ij

D E X P x X P

x1j x2j x3j Xj P1 P2 P3 P1Xj P2Xj P3Xj

  • Theory:

The Levenbergโ€“Marquardt algorithm

  • Practice:

The Ceres-Solver from Google

slide-30
SLIDE 30

Auto-calibration

  • Auto-calibration: determining intrinsic camera

parameters directly from uncalibrated images

  • For example, we can use the constraint that a

moving camera has a fixed intrinsic matrix

  • Compute initial projective reconstruction and find 3D

projective transformation matrix Q such that all camera matrices are in the form Pi = K [Ri | ti]

  • Can use constraints on the form of the calibration

matrix, such as zero skew

slide-31
SLIDE 31

Summary so far

  • From two images, we can:
  • Recover fundamental matrix F
  • Recover canonical camera projection matrix P and Pโ€™ from F
  • Estimate 3D positions (if K is known) that correspond to each

pixel

  • For a moving camera, we can:
  • Initialize by computing F, P, X for two images
  • Sequentially add new images, computing new P, refining X, and

adding points

  • Auto-calibrate assuming fixed calibration matrix to upgrade to

similarity transform

slide-32
SLIDE 32

Recent work in SfM

  • Reconstruct from many images by efficiently finding

subgraphs

  • http://www.cs.cornell.edu/projects/matchminer/ (Lou et
  • al. ECCV 2012)
  • Improving efficiency of bundle adjustment or
  • http://vision.soic.indiana.edu/projects/disco/ (Crandall et al. ECCV 2011)
  • http://imagine.enpc.fr/~moulonp/publis/iccv2013/index.html (Moulin et
  • al. ICCV 2013)

Reconstruction of Cornell (Crandall et al. ECCV 2011) (best method with software available; also has good overview of recent methods)

slide-33
SLIDE 33

3D from multiple images

Building Rome in a Day: Agarwal et al. 2009

slide-34
SLIDE 34

Structure from motion under orthographic projection

3D Reconstruction of a Rotating Ping-Pong Ball

  • C. Tomasi and T. Kanade. Shape and motion from image streams under orthography:

A factorization method. IJCV, 9(2):137-154, November 1992.

  • Reasonable choice when
  • Change in depth of points in scene is much smaller than distance to camera
  • Cameras do not move towards or away from the scene
slide-35
SLIDE 35

Orthographic Projection - Examples

slide-36
SLIDE 36

Orthographic projection for rotated/translated camera

x X a1 a2

slide-37
SLIDE 37

Affine structure from motion

  • Affine projection is a linear mapping + translation in

homogeneous coordinates

1. We are given corresponding 2D points (x) in several frames 2. We want to estimate the 3D points (X) and the affine parameters of each camera (A)

x X a1 a2

t AX x ๏€ซ ๏€ฝ ๏ƒท ๏ƒท ๏ƒธ ๏ƒถ ๏ƒง ๏ƒง ๏ƒจ ๏ƒฆ ๏€ซ ๏ƒท ๏ƒท ๏ƒท ๏ƒธ ๏ƒถ ๏ƒง ๏ƒง ๏ƒง ๏ƒจ ๏ƒฆ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒซ ๏ƒฉ ๏€ฝ ๏ƒท ๏ƒท ๏ƒธ ๏ƒถ ๏ƒง ๏ƒง ๏ƒจ ๏ƒฆ ๏€ฝ

y x

t t Z Y X a a a a a a y x

23 22 21 13 12 11

Projection of world origin

slide-38
SLIDE 38

Step 1: Simplify by getting rid of t: shift to centroid of points for each camera

๏ƒฅ

๏€ฝ

๏€ญ ๏€ฝ

n k ik ij ij

n

1

1 ห† x x x

i i i

t X A x ๏€ซ ๏€ฝ

๏€จ ๏€ฉ

j i n k k j i n k i k i i j i n k ik ij

n n n X A X X A t X A t X A x x ห† 1 1 1

1 1 1

๏€ฝ ๏ƒท ๏ƒธ ๏ƒถ ๏ƒง ๏ƒจ ๏ƒฆ ๏€ญ ๏€ฝ ๏€ซ ๏€ญ ๏€ซ ๏€ฝ ๏€ญ

๏ƒฅ ๏ƒฅ ๏ƒฅ

๏€ฝ ๏€ฝ ๏€ฝ j i ij

X A x ห† ห† ๏€ฝ

2d normalized point (observed) 3d normalized point Linear (affine) mapping

slide-39
SLIDE 39

Suppose we know 3D points and affine camera parameters โ€ฆ

then, we can compute the observed 2d positions of each point

๏› ๏

๏ƒบ ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏€ฝ ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ

mn m m n n n m

x x x x x x x x x X X X A A A ห† ห† ห† ห† ห† ห† ห† ห† ห†

2 1 2 22 21 1 12 11 2 1 2 1

๏Œ ๏ ๏Œ ๏Œ ๏Œ ๏

Camera Parameters (2mx3) 3D Points (3xn) 2D Image Points (2mxn)

slide-40
SLIDE 40

What if we instead observe corresponding 2d image points?

Can we recover the camera parameters and 3d points?

cameras (2m) points (n)

๏› ๏

n m mn m m n n

X X X A A A x x x x x x x x x D ๏Œ ๏ ๏Œ ๏ ๏Œ ๏Œ

2 1 2 1 2 1 2 22 21 1 12 11

? ห† ห† ห† ห† ห† ห† ห† ห† ห† ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏ƒž ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏€ฝ

What rank is the matrix of 2D points?

slide-41
SLIDE 41

Factorizing the measurement matrix

Source: M. Hebert

AX

slide-42
SLIDE 42

Factorizing the measurement matrix

Source: M. Hebert

  • Singular value decomposition of D:
slide-43
SLIDE 43

Factorizing the measurement matrix

Source: M. Hebert

  • Singular value decomposition of D:
slide-44
SLIDE 44

Factorizing the measurement matrix

Source: M. Hebert

  • Obtaining a factorization from SVD:
slide-45
SLIDE 45

Factorizing the measurement matrix

Source: M. Hebert

A ~ X ~

  • Obtaining a factorization from SVD:
slide-46
SLIDE 46

Affine ambiguity

  • The decomposition is not unique.

We get the same D by using any 3ร—3 matrix C and applying the transformations A โ†’ AC, X โ†’C-1X

  • Why?

We have only an affine transformation and we have not enforced any Euclidean constraints (e.g., perpendicular image axes)

Source: M. Hebert

S ~ A ~ X ~

slide-47
SLIDE 47
  • Orthographic: image axes are perpendicular and of

unit length

Eliminating the affine ambiguity

x X a1 a2

a1 ยท a2 = 0

|a1|2 = |a2|2 = 1

Source: M. Hebert

slide-48
SLIDE 48

Solve for orthographic constraints

  • Solve for L = CCT
  • Recover C from L by Cholesky decomposition:

L = CCT

  • Update A and X: A = AC, X = C-1X

๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒซ ๏ƒฉ ๏€ฝ

T i T i i 2 1

~ ~ ~ a a A

where

1 ~ ~

1 1

๏€ฝ

i T T i

a CC a 1 ~ ~

2 2

๏€ฝ

i T T i

a CC a ~ ~

2 1

๏€ฝ

i T T i

a CC a

~ ~

Three equations for each image i

slide-49
SLIDE 49

How to solve L L = = CC CCT ?

๐‘ ๐‘ ๐‘‘ ๐‘€11 ๐‘€21 ๐‘€31 ๐‘€12 ๐‘€22 ๐‘€32 ๐‘€13 ๐‘€23 ๐‘€33 ๐‘’ ๐‘“ ๐‘” = ๐‘™

๐‘๐‘’ ๐‘๐‘’ ๐‘‘๐‘’ ๐‘๐‘“ ๐‘๐‘“ ๐‘‘๐‘“ ๐‘๐‘” ๐‘๐‘” ๐‘‘๐‘” ๐‘€11 ๐‘€12 ๐‘€13 ๐‘€21 ๐‘€22 ๐‘€23 ๐‘€31 ๐‘€32 ๐‘€33 = k

slide-50
SLIDE 50

How to solve L L = = CC CCT ?

๐‘ ๐‘ ๐‘‘ ๐‘€11 ๐‘€21 ๐‘€31 ๐‘€12 ๐‘€22 ๐‘€32 ๐‘€13 ๐‘€23 ๐‘€33 ๐‘’ ๐‘“ ๐‘” = ๐‘™

๐‘๐‘’ ๐‘๐‘’ ๐‘‘๐‘’ ๐‘๐‘“ ๐‘๐‘“ ๐‘‘๐‘“ ๐‘๐‘” ๐‘๐‘” ๐‘‘๐‘” ๐‘€11 ๐‘€12 ๐‘€13 ๐‘€21 ๐‘€22 ๐‘€23 ๐‘€31 ๐‘€32 ๐‘€33 = k

reshape([a b c]โ€™*[d e f], [1, 9])

slide-51
SLIDE 51

Algorithm summary

  • Given: m images and n tracked features xij
  • For each image i, center the feature coordinates
  • Construct a 2m ร— n measurement matrix D:
  • Column j contains the projection of point j in all views
  • Row i contains one coordinate of the projections of all the n

points in image i

  • Factorize D:
  • Compute SVD: D = U W VT
  • Create U3 by taking the first 3 columns of U
  • Create V3 by taking the first 3 columns of V
  • Create W3 by taking the upper left 3 ร— 3 block of W
  • Create the motion (affine) and shape (3D) matrices:

A = U3W3

ยฝ and S = W3 ยฝ V3 T

  • Eliminate affine ambiguity
  • Solve L = CCT using metric constraints
  • Solve C using Cholesky decomposition
  • Update A and X: A = AC, S = C-1S

Source: M. Hebert

slide-52
SLIDE 52

Dealing with missing data

  • So far, we have assumed that all points are visible

in all views

  • In reality, the measurement matrix typically looks

something like this: One solution:

  • solve using a dense submatrix of visible points
  • Iteratively add new cameras

cameras points

slide-53
SLIDE 53

Reconstruction results

  • C. Tomasi and T. Kanade. Shape and motion from image streams under orthography:

A factorization method. IJCV, 9(2):137-154, November 1992.

slide-54
SLIDE 54

Further reading

  • Short explanation of Affine SfM: class notes from

Lischinksi and Gruber http://www.cs.huji.ac.il/~csip/sfm.pdf

  • Clear explanation of epipolar geometry and

projective SfM

  • http://mi.eng.cam.ac.uk/~cipolla/publications/contributionToEditedB
  • ok/2008-SFM-chapters.pdf
slide-55
SLIDE 55

Review of Affine SfM from Interest Points

  • 1. Detect interest points (e.g., Harris)

๏ƒบ ๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒช ๏ƒซ ๏ƒฉ ๏€ช ๏€ฝ ) ( ) ( ) ( ) ( ) ( ) , (

2 2 D y D y x D y x D x I D I

I I I I I I g ๏ณ ๏ณ ๏ณ ๏ณ ๏ณ ๏ณ ๏ณ ๏ญ

59

  • 1. Image

derivatives

  • 2. Square of

derivatives

  • 3. Gaussian

filter g(๏ณI)

Ix Iy Ix

2

Iy

2

IxIy g(Ix

2)

g(Iy

2)

g(IxIy)

2 2 2 2 2 2

)] ( ) ( [ )] ( [ ) ( ) (

y x y x y x

I g I g I I g I g I g ๏€ซ ๏€ญ ๏€ญ ๏ก ๏€ฝ ๏€ญ ๏€ฝ ] )) , ( [trace( )] , ( det[

2 D I D I

har ๏ณ ๏ณ ๏ญ ๏ก ๏ณ ๏ณ ๏ญ

  • 4. Cornerness function โ€“ both eigenvalues are strong

har

  • 5. Non-maxima suppression

1 2 1 2

det trace M M ๏ฌ ๏ฌ ๏ฌ ๏ฌ ๏€ฝ ๏€ฝ ๏€ซ

slide-56
SLIDE 56

Review of Affine SfM from Interest Points

  • 2. Correspondence via Lucas-Kanade tracking

a) Initialize (xโ€™,yโ€™) = (x,y) b) Compute (u,v) by c) Shift window by (u, v): xโ€™=xโ€™+u; yโ€™=yโ€™+v; d) Recalculate It e) Repeat steps 2-4 until small change

  • Use interpolation for subpixel values

2nd moment matrix for feature patch in first image displacement It = I(xโ€™, yโ€™, t+1) - I(x, y, t) Original (x,y) position

slide-57
SLIDE 57

Review of Affine SfM from Interest Points

  • 3. Get Affine camera matrix and 3D points using

Tomasi-Kanade factorization Solve for

  • rthographic

constraints

slide-58
SLIDE 58

HW 3 โ€“ Part 1 Epipolar Geometry

Problem: recover F from matches with outliers

load matches.mat

[c1, r1] โ€“ 477 x 2 [c2, r2] โ€“ 500 x 2 matches โ€“ 252 x 2 matches(:,1): matched point in im1 matches(:,2): matched point in im2

Write-up:

  • Describe what test you used for deciding inlier vs. outlier.
  • Display the estimated fundamental matrix F after normalizing to unit length
  • Plot the outlier keypoints with green dots on top of the first image plot(x, y, '.g');
  • Plot the corresponding epipolar lines
slide-59
SLIDE 59

Distance of point to epipolar line

x

.

xโ€˜=[u v 1]

.

l=Fx=[a b c]

๐‘’ ๐‘š, ๐‘ฆโ€ฒ = |๐‘๐‘ฃ + ๐‘๐‘ค + ๐‘‘| ๐‘2 + ๐‘2

slide-60
SLIDE 60

HW 3 โ€“ Part 2 Affine SfM

Problem: recover motion and structure

load tracks.mat

track_x โ€“ [500 x 51] track_y - [500 x 51] Use plotSfM(A, S) to diplay motion and shape A โ€“ [2m x 3] motion matrix S โ€“ [3 x n]

slide-61
SLIDE 61

HW 3 โ€“ Part 2 Affine SfM

  • Eliminate affine ambiguity
  • Solve for L = CCT
  • L = reshape(A\b, [3,3]); % A - 3m x 9, b โ€“ 3m x 1
  • Recover C from L by Cholesky decomposition: L =

CCT

  • Update A and X: A = AC, X = C-1X

๏ƒบ ๏ƒป ๏ƒน ๏ƒช ๏ƒซ ๏ƒฉ ๏€ฝ

T i T i i 2 1

~ ~ ~ a a A

where

1 ~ ~

1 1

๏€ฝ

i T T i

a CC a 1 ~ ~

2 2

๏€ฝ

i T T i

a CC a ~ ~

2 1

๏€ฝ

i T T i

a CC a

slide-62
SLIDE 62

HW 3 โ€“ Graduate credits Sin ingle-view metrology

Assume Sign = 1.65m Question: Whatโ€™s the heights of

  • Building
  • Tractor
  • Camera
slide-63
SLIDE 63

HW 3 โ€“ Graduate credits Automatic vanishing point detection

Input:

  • lines: a matrix of size [NumLines x 5] where each row represents a line

segment with (x1, y1, x2, y2, lineLength) Output:

  • VP: [2 x 3] each column corresponds to a vanishing point in the order of

X, Y, Z

  • lineLabel: [NumLine x 3] each column is a logical vector indicating which

line segments correspond to the vanishing point.

slide-64
SLIDE 64

HW 3 โ€“ Graduate credits Epipolar Geometry ry

Try โ€œun-normalizedโ€ 8-point algorithm. Report and compare the accuracy with the normalized version

slide-65
SLIDE 65

HW 3 โ€“ Graduate credits Affi fine stru ructure fr from motion

  • Missing track completion.
  • Some keypoints will fall out of frame, or come into

frame throughout the sequence.

  • Fill in the missing data and visualize the predicted

positions of points that aren't visible in a particular frame.

slide-66
SLIDE 66

Multi-view stereo

slide-67
SLIDE 67

Multi-view stereo

  • Generic problem formulation: given several images of

the same object or scene, compute a representation

  • f its 3D shape
  • โ€œImages of the same object or sceneโ€
  • Arbitrary number of images (from two to thousands)
  • Arbitrary camera positions (special rig, camera network
  • r video sequence)
  • Calibration may be known or unknown
  • โ€œRepresentation of 3D shapeโ€
  • Depth maps
  • Meshes
  • Point clouds
  • Patch clouds
  • Volumetric models
  • โ€ฆ.
slide-68
SLIDE 68

Multi-view stereo: Basic idea

Source: Y. Furukawa

slide-69
SLIDE 69

Multi-view stereo: Basic idea

Source: Y. Furukawa

slide-70
SLIDE 70

Multi-view stereo: Basic idea

Source: Y. Furukawa

slide-71
SLIDE 71

Multi-view stereo: Basic idea

Source: Y. Furukawa

slide-72
SLIDE 72

Plane Sweep Stereo

  • Sweep family of planes at different depths w.r.t. a reference camera
  • For each depth, project each input image onto that plane
  • This is equivalent to a homography warping each input image into the reference

view

  • What can we say about the scene points that are at the right depth?

reference camera input image

  • R. Collins. A space-sweep approach to true multi-image matching. CVPR 1996.

input image

slide-73
SLIDE 73

Plane Sweep Stereo

Image 1 Image 2 Sweeping plane Scene surface

slide-74
SLIDE 74

Plane Sweep Stereo

  • For each depth plane
  • For each pixel in the composite image stack, compute the variance
  • For each pixel, select the depth that gives the lowest variance
  • Can be accelerated using graphics hardware
  • R. Yang and M. Pollefeys. Multi-Resolution Real-Time Stereo on Commodity Graphics

Hardware, CVPR 2003

slide-75
SLIDE 75

Merging depth maps

  • Given a group of images, choose each
  • ne as reference and compute a

depth map w.r.t. that view using a multi-baseline approach

  • Merge multiple depth maps to a

volume or a mesh (see, e.g., Curless and Levoy 96)

Map 1 Map 2 Merged

slide-76
SLIDE 76

Stereo from community photo collections

  • Need structure from motion to recover unknown

camera parameters

  • Need view selection to find good groups of images
  • n which to run dense stereo
slide-77
SLIDE 77
slide-78
SLIDE 78
slide-79
SLIDE 79
slide-80
SLIDE 80

Towards Internet-Scale Multi-View Stereo

  • YouTube video, high-quality video

Yasutaka Furukawa, Brian Curless, Steven M. Seitz and Richard Szeliski, Towards Internet- scale Multi-view Stereo,CVPR 2010.

slide-81
SLIDE 81

Internet-Scale Multi-View Stereo

slide-82
SLIDE 82

The Visual Turing Test for Scene Reconstruction

  • Q. Shan, R. Adams, B. Curless, Y. Furukawa, and S. Seitz, "The Visual Turing Test for Scene

Reconstruction," 3DV 2013.

slide-83
SLIDE 83

The Reading List

  • โ€œA computer algorithm for reconstructing a scene from two imagesโ€, Longuet-Higgins, Nature

1981

  • โ€œShape and motion from image streams under orthography:

A factorization method.โ€ C. Tomasi and T. Kanade, IJCV, 9(2):137-154, November 1992

  • โ€œIn defense of the eight-point algorithmโ€, Hartley, PAMI 1997
  • โ€œAn efficient solution to the five-point relative pose problemโ€, Nister, PAMI 2004
  • โ€œAccurate, dense, and robust multiview stereopsisโ€, Furukawa and Ponce, CVPR 2007
  • โ€œPhoto tourism: exploring image collections in 3dโ€, ACM SIGGRAPH 2006
  • โ€œBuilding Rome in a dayโ€, Agarwal et al., ICCV 2009
  • https://www.youtube.com/watch?v=kyIzMr917Rc, 3D Computer Vision: Past, Present, and Future
slide-84
SLIDE 84

Next class

  • Grouping and Segmentation