776 Computer Vision
description
Transcript of 776 Computer Vision
![Page 1: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/1.jpg)
776 Computer VisionJan-Michael Frahm
Spring 2012
![Page 2: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/2.jpg)
Structure from motion
![Page 3: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/3.jpg)
Spatial Correlation
3
Spatial ordering
images, 2D features
![Page 4: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/4.jpg)
Spatial Correlation
4
Spatial ordering
images, 2D featurescorrespondences
![Page 5: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/5.jpg)
Spatial ordering
images, 2D feature correspondences
3D from images
Camera 1Camera 2
Camera 3
3D points & camera poses
images, camera poses
5
![Page 6: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/6.jpg)
3D model from video
Spatial ordering
3D points & camera poses
Dense 3D
images, 2D feature correspondences
images, camera poses
images, camera poses, depth maps
6
far
near
![Page 7: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/7.jpg)
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 correspondences xij
x1j
x2j
x3j
Xj
P1
P2
P3
![Page 8: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/8.jpg)
Structure from motion ambiguity
• If we scale the entire scene by some factor k and, at the same time, scale the camera matrices by the factor of 1/k, the projections of the scene points in the image remain exactly the same:
It is impossible to recover the absolute scale of the scene!
)(1 XPPXx kk
![Page 9: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/9.jpg)
Structure from motion ambiguity
• If we scale the entire scene by some factor k and, at the same time, scale the camera matrices by the factor of 1/k, the projections of the scene points in the image remain exactly the same
• More generally: if we transform the scene using a transformation Q and apply the inverse transformation to the camera matrices, then the images do not change
QXPQPXx -1
![Page 10: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/10.jpg)
Types of ambiguity
vTvtAProjective
15dof
Affine12dof
Similarity7dof
Euclidean6dof
Preserves intersection and tangency
Preserves parallellism, volume ratios
Preserves angles, ratios of length
10tA
T
10tR
T
s
10tR
TPreserves angles, lengths
• With no constraints on the camera calibration matrix or on the scene, we get a projective reconstruction
• Need additional information to upgrade the reconstruction to affine, similarity, or Euclidean
![Page 11: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/11.jpg)
Projective ambiguity
XQPQPXx P-1
P
vTvtA
pQ
![Page 12: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/12.jpg)
Projective ambiguity
![Page 13: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/13.jpg)
Affine ambiguity
XQPQPXx A-1
A
Affine
10tA
TAQ
![Page 14: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/14.jpg)
Affine ambiguity
![Page 15: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/15.jpg)
Similarity ambiguity
XQPQPXx S-1S
10tR
T
ssQ
![Page 16: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/16.jpg)
Similarity ambiguity
![Page 17: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/17.jpg)
Structure from motion• Let’s start with affine cameras (the math is
easier)
center atinfinity
![Page 18: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/18.jpg)
Recall: Orthographic Projection
• Special case of perspective projectiono Distance from center of projection to image plane is infinite
o Projection matrix:
Image World
Slide by Steve Seitz
![Page 19: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/19.jpg)
Orthographic Projection
Parallel Projection
Affine cameras
![Page 20: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/20.jpg)
Affine cameras• A general affine camera combines the effects of
an affine transformation of the 3D space, orthographic projection, and an affine transformation of the image:
• Affine projection is a linear mapping + translation in inhomogeneous coordinates
10bA
P1000
]affine44[100000100001
]affine33[ 2232221
1131211
baaabaaa
x
Xa1
a2
bAXx
2
1
232221
131211
bb
ZYX
aaaaaa
yx
Projection ofworld origin
![Page 21: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/21.jpg)
Affine structure from motion• Given: m images of n fixed 3D points:
• xij = Ai Xj + bi , i = 1,… , m, j = 1, … , n
• Problem: use the mn correspondences xij to estimate m projection matrices Ai and translation vectors bi, and n points Xj
• The reconstruction is defined up to an arbitrary affine transformation Q (12 degrees of freedom):
• We have 2mn knowns and 8m + 3n unknowns (minus 12 dof for affine ambiguity)
• Thus, we must have 2mn >= 8m + 3n – 12• For two views, we need four point correspondences
1X
Q1X
,Q10bA
10bA 1
![Page 22: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/22.jpg)
Affine structure from motion• Centering: subtract the centroid of the image
points
• For simplicity, assume that the origin of the world coordinate system is at the centroid of the 3D points
• After centering, each normalized point xij is related to the 3D point Xi by
ji
n
kkji
n
kikiiji
n
kikijij
n
nn
XAXXA
bXAbXAxxx
ˆ1
11ˆ
1
11
jiij XAx ˆ
![Page 23: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/23.jpg)
Affine structure from motion• Let’s create a 2m × n data (measurement)
matrix:
mnmm
n
n
xxx
xxxxxx
D
ˆˆˆ
ˆˆˆˆˆˆ
21
22221
11211
cameras(2 m)
points (n)
C. Tomasi and T. Kanade. Shape and motion from image streams under orthography: A factorization method. IJCV, 9(2):137-154, November 1992.
![Page 24: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/24.jpg)
Affine structure from motion• Let’s create a 2m × n data (measurement)
matrix:
cameras(2 m × 3)
points (3 × n)
The measurement matrix D = MS must have rank 3!
C. Tomasi and T. Kanade. Shape and motion from image streams under orthography: A factorization method. IJCV, 9(2):137-154, November 1992.
![Page 25: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/25.jpg)
Factorizing the measurement matrix
Source: M. Hebert
![Page 26: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/26.jpg)
Factorizing the measurement matrix
• Singular value decomposition of D:
Source: M. Hebert
![Page 27: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/27.jpg)
Factorizing the measurement matrix
• Singular value decomposition of D:
Source: M. Hebert
![Page 28: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/28.jpg)
Factorizing the measurement matrix
• Obtaining a factorization from SVD:
Source: M. Hebert
![Page 29: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/29.jpg)
Factorizing the measurement matrix
• Obtaining a factorization from SVD:
Source: M. Hebert
This decomposition minimizes|D-MS|2
![Page 30: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/30.jpg)
Affine ambiguity
• The decomposition is not unique. We get the same D by using any 3×3 matrix C and applying the transformations M → MC, S →C-1S
• That is because we have only an affine transformation and we have not enforced any Euclidean constraints (like forcing the image axes to be perpendicular, for example)
Source: M. Hebert
![Page 31: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/31.jpg)
• Orthographic: image axes are perpendicular and scale is 1
• This translates into 3m equations in L = CCT :• Ai L Ai
T = Id, i = 1, …, mo Solve for Lo Recover C from L by Cholesky decomposition: L = CCT
o Update M and S: M = MC, S = C-1S
Eliminating the affine ambiguity
x
Xa1
a2
a1 · a2 = 0
|a1|2 = |a2|2 = 1
Source: M. Hebert
![Page 32: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/32.jpg)
Algorithm summary• Given: m images and n features xij
• For each image i, center the feature coordinates
• Construct a 2m × n measurement matrix D:o Column j contains the projection of point j in all viewso Row i contains one coordinate of the projections of all the n points
in image i• Factorize D:
o Compute SVD: D = U W VT
o Create U3 by taking the first 3 columns of Uo Create V3 by taking the first 3 columns of Vo Create W3 by taking the upper left 3 × 3 block of W
• Create the motion and shape matrices:o M = U3W3
½ and S = W3½ V3
T (or M = U3 and S = W3V3T)
• Eliminate affine ambiguitySource: M. Hebert
![Page 33: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/33.jpg)
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.
![Page 34: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/34.jpg)
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:
cameras
points
![Page 35: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/35.jpg)
Dealing with missing data• Possible solution: decompose matrix into dense
sub-blocks, factorize each sub-block, and fuse the resultso Finding dense maximal sub-blocks of the matrix is NP-complete
(equivalent to finding maximal cliques in a graph)• Incremental bilinear refinement
(1) Perform factorization on a dense sub-block
(2) Solve for a new 3D point visible by at least two known cameras (linear least squares)
(3) Solve for a new camera that sees at least three known 3D points (linear least squares)F. Rothganger, S. Lazebnik, C. Schmid, and J. Ponce.
Segmenting, Modeling, and Matching Video Clips Containing Multiple Moving Objects. PAMI 2007.
![Page 36: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/36.jpg)
Projective structure from motion
• Given: m images of n fixed 3D points • zij xij = Pi Xj , i = 1,… , m, j = 1, … , n
• Problem: estimate m projection matrices Pi and n 3D points Xj from the mn correspondences xij
x1j
x2j
x3j
Xj
P1
P2
P3
![Page 37: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/37.jpg)
Projective structure from motion
• Given: m images of n fixed 3D points • zij xij = Pi Xj , i = 1,… , m, j = 1, … , n
• Problem: estimate m projection matrices Pi and n 3D points Xj from the mn correspondences 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
![Page 38: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/38.jpg)
Projective SFM: Two-camera case
• Compute fundamental matrix F between the two views
• First camera matrix: [I|0]• Second camera matrix: [A|b]• Then b is the epipole (FTb = 0), A = –[b×]F
F&P sec. 13.3.1
![Page 39: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/39.jpg)
Sequential structure from motion
•Initialize motion from two images using fundamental matrix
•Initialize structure by triangulation
•For each additional view:o Determine projection matrix
of new camera using all the known 3D points that are visible in its image – calibration
cam
eras
points
![Page 40: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/40.jpg)
Sequential structure from motion
•Initialize motion from two images using fundamental matrix
•Initialize structure by triangulation
•For each additional view:o Determine projection matrix of
new camera using all the known 3D points that are visible in its image – calibration
o Refine and extend structure: compute new 3D points, re-optimize existing points that are also seen by this camera – triangulation
cam
eras
points
![Page 41: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/41.jpg)
Sequential structure from motion
•Initialize motion from two images using fundamental matrix
•Initialize structure by triangulation
•For each additional view:o Determine projection matrix of
new camera using all the known 3D points that are visible in its image – calibration
o Refine and extend structure: compute new 3D points, re-optimize existing points that are also seen by this camera – triangulation
•Refine structure and motion: bundle adjustment
cam
eras
points
![Page 42: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/42.jpg)
Bundle adjustment• Non-linear method for refining structure and
motion• Minimizing reprojection error
2
1 1
,),(
m
i
n
jjiijDE XPxXP
x1j
x2j
x3j
Xj
P1
P2
P3
P1Xj
P2XjP3Xj
![Page 43: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/43.jpg)
Self-calibration• Self-calibration (auto-calibration) is the process of
determining intrinsic camera parameters directly from uncalibrated images
• For example, when the images are acquired by a single moving camera, we can use the constraint that the intrinsic parameter matrix remains fixed for all the imageso 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: zero skew
• Can use vanishing points
![Page 44: 776 Computer Vision](https://reader035.fdocuments.us/reader035/viewer/2022062218/5681657f550346895dd818ad/html5/thumbnails/44.jpg)
Review: Structure from motion
• Ambiguity• Affine structure from motion
o Factorization• Dealing with missing data
o Incremental structure from motion• Projective structure from motion
o Bundle adjustmento Self-calibration