Structure from Motion (With a digression on SVD).

Slides:



Advertisements
Similar presentations
3D Geometry for Computer Graphics
Advertisements

Announcements. Structure-from-Motion Determining the 3-D structure of the world, and/or the motion of a camera using a sequence of images taken by a moving.
The fundamental matrix F
3D reconstruction.
PCA + SVD.
3D Reconstruction – Factorization Method Seong-Wook Joo KG-VISA 3/10/2004.
Two-View Geometry CS Sastry and Yang
1cs542g-term High Dimensional Data  So far we’ve considered scalar data values f i (or interpolated/approximated each component of vector values.
CSc D Computer Vision – Ioannis Stamos 3-D Computer Vision CSc Camera Calibration.
Dan Witzner Hansen  Groups?  Improvements – what is missing?
Structure from motion.
Stanford CS223B Computer Vision, Winter 2005 Lecture 11: Structure From Motion 2 Sebastian Thrun, Stanford Rick Szeliski, Microsoft Hendrik Dahlkamp and.
Computer Graphics Recitation 5.
3D Geometry for Computer Graphics
Some useful linear algebra. Linearly independent vectors span(V): span of vector space V is all linear combinations of vectors v i, i.e.
Stanford CS223B Computer Vision, Winter 2007 Lecture 8 Structure From Motion Professors Sebastian Thrun and Jana Košecká CAs: Vaibhav Vaish and David Stavens.
Math for CSLecture 41 Linear Least Squares Problem Over-determined systems Minimization problem: Least squares norm Normal Equations Singular Value Decomposition.
Singular Value Decomposition COS 323. Underconstrained Least Squares What if you have fewer data points than parameters in your function?What if you have.
Epipolar geometry. (i)Correspondence geometry: Given an image point x in the first view, how does this constrain the position of the corresponding point.
Structure from motion. Multiple-view geometry questions Scene geometry (structure): Given 2D point matches in two or more images, where are the corresponding.
Uncalibrated Geometry & Stratification Sastry and Yang
Stanford CS223B Computer Vision, Winter 2006 Lecture 8 Structure From Motion Professor Sebastian Thrun CAs: Dan Maynes-Aminzade, Mitul Saha, Greg Corrado.
Calibration Dorit Moshe.
SVD and PCA COS 323. Dimensionality Reduction Map points in high-dimensional space to lower number of dimensionsMap points in high-dimensional space to.
The Terms that You Have to Know! Basis, Linear independent, Orthogonal Column space, Row space, Rank Linear combination Linear transformation Inner product.
Structure From Motion Sebastian Thrun, Gary Bradski, Daniel Russakoff
© 2003 by Davi GeigerComputer Vision October 2003 L1.1 Structure-from-EgoMotion (based on notes from David Jacobs, CS-Maryland) Determining the 3-D structure.
Previously Two view geometry: epipolar geometry Stereo vision: 3D reconstruction epipolar lines Baseline O O’ epipolar plane.
3D Geometry for Computer Graphics
3D Geometry for Computer Graphics
CSCE 641 Computer Graphics: Image-based Modeling (Cont.) Jinxiang Chai.
SVD and PCA COS 323, Spring 05. SVD and PCA Principal Components Analysis (PCA): approximating a high-dimensional data set with a lower-dimensional subspacePrincipal.
Camera parameters Extrinisic parameters define location and orientation of camera reference frame with respect to world frame Intrinsic parameters define.
CSCE 641 Computer Graphics: Image-based Modeling (Cont.) Jinxiang Chai.
1cs542g-term Notes  Extra class next week (Oct 12, not this Friday)  To submit your assignment: me the URL of a page containing (links to)
Introduction The central problems of Linear Algebra are to study the properties of matrices and to investigate the solutions of systems of linear equations.
SVD(Singular Value Decomposition) and Its Applications
CSE554AlignmentSlide 1 CSE 554 Lecture 8: Alignment Fall 2014.
Euclidean cameras and strong (Euclidean) calibration Intrinsic and extrinsic parameters Linear least-squares methods Linear calibration Degenerate point.
Camera Geometry and Calibration Thanks to Martial Hebert.
© 2005 Yusuf Akgul Gebze Institute of Technology Department of Computer Engineering Computer Vision Geometric Camera Calibration.
Course 12 Calibration. 1.Introduction In theoretic discussions, we have assumed: Camera is located at the origin of coordinate system of scene.
Structure from Motion Computer Vision CS 143, Brown James Hays 11/18/11 Many slides adapted from Derek Hoiem, Lana Lazebnik, Silvio Saverese, Steve Seitz,
CSCE 643 Computer Vision: Structure from Motion
Affine Structure from Motion
EECS 274 Computer Vision Affine Structure from Motion.
Review of Linear Algebra Optimization 1/16/08 Recitation Joseph Bradley.
EIGENSYSTEMS, SVD, PCA Big Data Seminar, Dedi Gadot, December 14 th, 2014.
776 Computer Vision Jan-Michael Frahm & Enrique Dunn Spring 2013.
Structure from Motion ECE 847: Digital Image Processing
Recognition, SVD, and PCA. Recognition Suppose you want to find a face in an imageSuppose you want to find a face in an image One possibility: look for.
Structure from Motion Paul Heckbert, Nov , Image-Based Modeling and Rendering.
Instructor: Mircea Nicolescu Lecture 8 CS 485 / 685 Computer Vision.
Structure from motion Multi-view geometry Affine structure from motion Projective structure from motion Planches : –
Instructor: Mircea Nicolescu Lecture 9
Structure from Motion. For now, static scene and moving cameraFor now, static scene and moving camera – Equivalently, rigidly moving scene and static.
Unsupervised Learning II Feature Extraction
Reconstruction of a Scene with Multiple Linearly Moving Objects Mei Han and Takeo Kanade CISC 849.
CSE 554 Lecture 8: Alignment
55:148 Digital Image Processing Chapter 11 3D Vision, Geometry
Introduction The central problems of Linear Algebra are to study the properties of matrices and to investigate the solutions of systems of linear equations.
Introduction The central problems of Linear Algebra are to study the properties of matrices and to investigate the solutions of systems of linear equations.
Eigen & Singular Value Decomposition
Two-view geometry Computer Vision Spring 2018, Lecture 10
Epipolar geometry.
Structure from motion Input: Output: (Tomasi and Kanade)
Singular Value Decomposition
Some useful linear algebra
Uncalibrated Geometry & Stratification
Structure from motion Input: Output: (Tomasi and Kanade)
Presentation transcript:

Structure from Motion (With a digression on SVD)

Structure from Motion For now, static scene and moving cameraFor now, static scene and moving camera – Equivalently, rigidly moving scene and static camera Limiting case of stereo with many camerasLimiting case of stereo with many cameras Limiting case of multiview camera calibration with unknown targetLimiting case of multiview camera calibration with unknown target Given n points and N camera positions, have 2nN equations and 3n+6N unknownsGiven n points and N camera positions, have 2nN equations and 3n+6N unknowns

Approaches Obtaining point correspondencesObtaining point correspondences – Optical flow – Stereo methods: correlation, feature matching Solving for points and camera motionSolving for points and camera motion – Nonlinear minimization (bundle adjustment) – Various approximations…

OrthographicApproximation Simplest SFM case: camera approximated by orthographic projectionSimplest SFM case: camera approximated by orthographic projection PerspectiveOrthographic

Weak Perspective An orthographic assumption is sometimes well approximated by a telephoto lensAn orthographic assumption is sometimes well approximated by a telephoto lens Weak Perspective

Consequences of Orthographic Projection Scene can be recovered up to scaleScene can be recovered up to scale Translation perpendicular to image plane can never be recoveredTranslation perpendicular to image plane can never be recovered

Orthographic Structure from Motion Method due to Tomasi & Kanade, 1992Method due to Tomasi & Kanade, 1992 Assume n points in space p 1 … p nAssume n points in space p 1 … p n Observed at N points in time at image coordinates (x ij, y ij )Observed at N points in time at image coordinates (x ij, y ij ) – Feature tracking, optical flow, etc.

Orthographic Structure from Motion Write down matrix of dataWrite down matrix of data Points  Frames 

Orthographic Structure from Motion Step 1: find translationStep 1: find translation Translation parallel to viewing direction can not be obtainedTranslation parallel to viewing direction can not be obtained Translation perpendicular to viewing direction equals motion of average position of all pointsTranslation perpendicular to viewing direction equals motion of average position of all points

Orthographic Structure from Motion Subtract average of each rowSubtract average of each row

Orthographic Structure from Motion Step 2: try to find rotationStep 2: try to find rotation Rotation at each frame defines local coordinate axes,, andRotation at each frame defines local coordinate axes,, and ThenThen

Orthographic Structure from Motion So, can write where R is a “rotation” matrix and S is a “shape” matrixSo, can write where R is a “rotation” matrix and S is a “shape” matrix

Orthographic Structure from Motion Goal is to factorGoal is to factor Before we do, observe that rank( ) = 3 (in ideal case with no noise)Before we do, observe that rank( ) = 3 (in ideal case with no noise) Proof:Proof: – Rank of R is 3 unless no rotation – Rank of S is 3 iff have noncoplanar points – Product of 2 matrices of rank 3 has rank 3 With noise, rank( ) might be > 3With noise, rank( ) might be > 3

Digression: Singular Value Decomposition (SVD) Handy mathematical technique that has application to many problemsHandy mathematical technique that has application to many problems Given any m  n matrix A, algorithm to find matrices U, V, and W such thatGiven any m  n matrix A, algorithm to find matrices U, V, and W such that A = U W V T U is m  n and orthonormal V is n  n and orthonormal W is n  n and diagonal

SVD Treat as black box: code widely available ( svd(A,0) in Matlab)Treat as black box: code widely available ( svd(A,0) in Matlab)

SVD The w i are called the singular values of AThe w i are called the singular values of A If A is singular, some of the w i will be 0If A is singular, some of the w i will be 0 In general rank(A) = number of nonzero w iIn general rank(A) = number of nonzero w i SVD is mostly unique (up to permutation of singular values, or if some w i are equal)SVD is mostly unique (up to permutation of singular values, or if some w i are equal)

SVD and Inverses Why is SVD so useful?Why is SVD so useful? Application #1: inversesApplication #1: inverses A -1 =(V T ) -1 W -1 U -1 = V W -1 U TA -1 =(V T ) -1 W -1 U -1 = V W -1 U T This fails when some w i are 0This fails when some w i are 0 – It’s supposed to fail – singular matrix Pseudoinverse: if w i =0, set 1/w i to 0 (!)Pseudoinverse: if w i =0, set 1/w i to 0 (!) – “Closest” matrix to inverse – Defined for all (even non-square) matrices

SVD and Least Squares Solving Ax=b by least squaresSolving Ax=b by least squares x=pseudoinverse(A) times bx=pseudoinverse(A) times b Compute pseudoinverse using SVDCompute pseudoinverse using SVD – Lets you see if data is singular – Even if not singular, ratio of max to min singular values (condition number) tells you how stable the solution will be – Set 1/w i to 0 if w i is small (even if not exactly 0)

SVD and Eigenvectors Let A=UWV T, and let x i be i th column of VLet A=UWV T, and let x i be i th column of V Consider A T A x i :Consider A T A x i : So elements of W are squared eigenvalues and columns of V are eigenvectors of A T ASo elements of W are squared eigenvalues and columns of V are eigenvectors of A T A

SVD and Eigenvectors Eigenvectors of A T A turned up in finding least-squares solution to Ax=0Eigenvectors of A T A turned up in finding least-squares solution to Ax=0 Solution is eigenvector corresponding to smallest eigenvalueSolution is eigenvector corresponding to smallest eigenvalue

SVD and Matrix Similarity One common definition for the norm of a matrix is the Frobenius norm:One common definition for the norm of a matrix is the Frobenius norm: Frobenius norm can be computed from SVDFrobenius norm can be computed from SVD So changes to a matrix can be evaluated by looking at changes to singular valuesSo changes to a matrix can be evaluated by looking at changes to singular values

SVD and Matrix Similarity Suppose you want to find best rank-k approximation to ASuppose you want to find best rank-k approximation to A Answer: set all but the largest k singular values to zeroAnswer: set all but the largest k singular values to zero Can form compact representation by eliminating columns of U and V corresponding to zeroed w iCan form compact representation by eliminating columns of U and V corresponding to zeroed w i

SVD and PCA Principal Components Analysis (PCA): approximating a high-dimensional data set with a lower-dimensional subspacePrincipal Components Analysis (PCA): approximating a high-dimensional data set with a lower-dimensional subspace Original axes * * * * * * * *** * * *** * * * * * * * * * Data points First principal component Second principal component

SVD and PCA Data matrix with points as rows, take SVDData matrix with points as rows, take SVD Columns of V k are principal componentsColumns of V k are principal components Value of w i gives importance of each componentValue of w i gives importance of each component

SVD and Orthogonalization The matrix U is the “closest” orthonormal matrix to AThe matrix U is the “closest” orthonormal matrix to A Yet another useful application of the matrix-approximation properties of SVDYet another useful application of the matrix-approximation properties of SVD Much more stable numerically than Graham-Schmidt orthogonalizationMuch more stable numerically than Graham-Schmidt orthogonalization Find rotation given general affine matrixFind rotation given general affine matrix

End of Digression Goal is to factor into R and SGoal is to factor into R and S Let’s apply SVD!Let’s apply SVD! But should have rank 3  all but 3 of the w i should be 0But should have rank 3  all but 3 of the w i should be 0 Extract the top 3 w i, together with the corresponding columns of U and VExtract the top 3 w i, together with the corresponding columns of U and V

Factoring for Orthographic Structure from Motion After extracting columns, U 3 has dimensions 2N  3 (just what we wanted for R)After extracting columns, U 3 has dimensions 2N  3 (just what we wanted for R) W 3 V 3 T has dimensions 3  n (just what we wanted for S)W 3 V 3 T has dimensions 3  n (just what we wanted for S) So, let R * =U 3, S * =W 3 V 3 TSo, let R * =U 3, S * =W 3 V 3 T

Affine Structure from Motion The i and j entries of R * are not, in general, unit length and perpendicularThe i and j entries of R * are not, in general, unit length and perpendicular We have found motion (and therefore shape) up to an affine transformationWe have found motion (and therefore shape) up to an affine transformation This is the best we could do if we didn’t assume orthographic cameraThis is the best we could do if we didn’t assume orthographic camera

Ensuring Orthogonality Since can be factored as R * S *, it can also be factored as (R * Q)(Q -1 S * ), for any QSince can be factored as R * S *, it can also be factored as (R * Q)(Q -1 S * ), for any Q So, search for Q such that R = R * Q has the properties we wantSo, search for Q such that R = R * Q has the properties we want

Ensuring Orthogonality Want orWant or Let T = QQ TLet T = QQ T Equations for elements of T – solve by least squaresEquations for elements of T – solve by least squares Ambiguity – add constraintsAmbiguity – add constraints

Ensuring Orthogonality Have found T = QQ THave found T = QQ T Find Q by taking “square root” of TFind Q by taking “square root” of T – Cholesky decomposition if T is positive definite – General algorithms (e.g. sqrtm in Matlab)

Orthogonal Structure from Motion Let’s recap:Let’s recap: – Write down matrix of observations – Find translation from avg. position – Subtract translation – Factor matrix using SVD – Write down equations for orthogonalization – Solve using least squares, square root At end, get matrix R = R * Q of camera positions and matrix S = Q -1 S * of 3D pointsAt end, get matrix R = R * Q of camera positions and matrix S = Q -1 S * of 3D points

Results Image sequenceImage sequence [Tomasi & Kanade]

Results Tracked featuresTracked features [Tomasi & Kanade]

Results Reconstructed shapeReconstructed shape [Tomasi & Kanade] Front view Top view