Two-view geometry Computer Vision Spring 2018, Lecture 10

Slides:



Advertisements
Similar presentations
Epipolar Geometry.
Advertisements

Lecture 11: Two-view geometry
3D reconstruction.
Jan-Michael Frahm, Enrique Dunn Spring 2012
Two-view geometry.
Lecture 8: Stereo.
Camera calibration and epipolar geometry
Structure from motion.
Stanford CS223B Computer Vision, Winter 2006 Lecture 5 Stereo I
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
Lecture 21: Multiple-view geometry and structure from motion
Lecture 20: Two-view geometry CS6670: Computer Vision Noah Snavely.
Single-view geometry Odilon Redon, Cyclops, 1914.
3D Computer Vision and Video Computing 3D Vision Lecture 14 Stereo Vision (I) CSC 59866CD Fall 2004 Zhigang Zhu, NAC 8/203A
Projected image of a cube. Classical Calibration.
May 2004Stereo1 Introduction to Computer Vision CS / ECE 181B Tuesday, May 11, 2004  Multiple view geometry and stereo  Handout #6 available (check with.
Lec 21: Fundamental Matrix
Camera parameters Extrinisic parameters define location and orientation of camera reference frame with respect to world frame Intrinsic parameters define.
Multiple View Geometry
Multiple View Geometry. THE GEOMETRY OF MULTIPLE VIEWS Reading: Chapter 10. Epipolar Geometry The Essential Matrix The Fundamental Matrix The Trifocal.
Structure Computation. How to compute the position of a point in 3- space given its image in two views and the camera matrices of those two views Use.
CS 558 C OMPUTER V ISION Lecture IX: Dimensionality Reduction.
3-D Scene u u’u’ Study the mathematical relations between corresponding image points. “Corresponding” means originated from the same 3D point. Objective.
Epipolar Geometry and Stereo Vision Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 04/12/11 Many slides adapted from Lana Lazebnik,
55:148 Digital Image Processing Chapter 11 3D Vision, Geometry Topics: Basics of projective geometry Points and hyperplanes in projective space Homography.
Multi-view geometry. Multi-view geometry problems Structure: Given projections of the same 3D point in two or more images, compute the 3D coordinates.
776 Computer Vision Jan-Michael Frahm, Enrique Dunn Spring 2013.
Automatic Camera Calibration
Epipolar Geometry and Stereo Vision Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 03/05/15 Many slides adapted from Lana Lazebnik,
Computer vision: models, learning and inference
Lecture 11 Stereo Reconstruction I Lecture 11 Stereo Reconstruction I Mata kuliah: T Computer Vision Tahun: 2010.
Epipolar Geometry and Stereo Vision Computer Vision ECE 5554 Virginia Tech Devi Parikh 10/15/13 These slides have been borrowed from Derek Hoiem and Kristen.
Camera Geometry and Calibration Thanks to Martial Hebert.
Multi-view geometry.
Epipolar geometry The fundamental matrix and the tensor
Projective cameras Motivation Elements of Projective Geometry Projective structure from motion Planches : –
© 2005 Yusuf Akgul Gebze Institute of Technology Department of Computer Engineering Computer Vision Geometric Camera Calibration.
Lecture 04 22/11/2011 Shai Avidan הבהרה : החומר המחייב הוא החומר הנלמד בכיתה ולא זה המופיע / לא מופיע במצגת.
Multiview Geometry and Stereopsis. Inputs: two images of a scene (taken from 2 viewpoints). Output: Depth map. Inputs: multiple images of a scene. Output:
Stereo Course web page: vision.cis.udel.edu/~cv April 11, 2003  Lecture 21.
1 Formation et Analyse d’Images Session 7 Daniela Hall 25 November 2004.
Announcements Project 3 due Thursday by 11:59pm Demos on Friday; signup on CMS Prelim to be distributed in class Friday, due Wednesday by the beginning.
Geometry of Multiple Views
Single-view geometry Odilon Redon, Cyclops, 1914.
Two-view geometry. Epipolar Plane – plane containing baseline (1D family) Epipoles = intersections of baseline with image planes = projections of the.
Feature Matching. Feature Space Outlier Rejection.
55:148 Digital Image Processing Chapter 11 3D Vision, Geometry Topics: Basics of projective geometry Points and hyperplanes in projective space Homography.
Computer vision: models, learning and inference M Ahad Multiple Cameras
MASKS © 2004 Invitation to 3D vision Uncalibrated Camera Chapter 6 Reconstruction from Two Uncalibrated Views Modified by L A Rønningen Oct 2008.
Stereo March 8, 2007 Suggested Reading: Horn Chapter 13.
Lec 26: Fundamental Matrix CS4670 / 5670: Computer Vision Kavita Bala.
Multi-view geometry. Multi-view geometry problems Structure: Given projections of the same 3D point in two or more images, compute the 3D coordinates.
Calibrating a single camera
55:148 Digital Image Processing Chapter 11 3D Vision, Geometry
Epipolar Geometry and Stereo Vision
Undergrad HTAs / TAs Help me make the course better!
CS4670 / 5670: Computer Vision Kavita Bala Lec 27: Stereo.
Epipolar geometry.
3D Photography: Epipolar geometry
Epipolar geometry continued
Two-view geometry.
Uncalibrated Geometry & Stratification
2D transformations (a.k.a. warping)
Reconstruction.
Two-view geometry.
Two-view geometry.
Multi-view geometry.
Single-view geometry Odilon Redon, Cyclops, 1914.
Presentation transcript:

Two-view geometry 16-385 Computer Vision Spring 2018, Lecture 10 http://www.cs.cmu.edu/~16385/

Course announcements Homework 2 is due on February 23rd. - Any questions about the homework? - How many of you have looked at/started/finished homework 2? Yannis’ office hours on Friday are 1-3:30pm. Yannis has extra office hours on Wednesday 3-5pm. The Hartley-Zisserman book is available online for free from CMU’s library.

Overview of today’s lecture Triangulation. Epipolar geometry. Essential matrix. Fundamental matrix. 8-point algorithm.

Slide credits Most of these slides were adapted from: Kris Kitani (16-385, Spring 2017).

Triangulation

estimate Structure Motion Measurements Pose Estimation Triangulation (scene geometry) Motion (camera geometry) Measurements Pose Estimation known estimate 3D to 2D correspondences Triangulation 2D to 2D coorespondences Reconstruction

Triangulation Given image 1 image 2 camera 1 with matrix

Triangulation Which 3D points map to x? image 1 image 2 camera 1 with matrix camera 2 with matrix

How can you compute this ray? Triangulation image 2 image 1 How can you compute this ray? camera 1 with matrix camera 2 with matrix

Why does this point map to x? Triangulation Create two points on the ray: find the camera center; and apply the pseudo-inverse of P on x. Then connect the two points. image 2 image 1 + Why does this point map to x? camera 1 with matrix camera 2 with matrix

How do we find the exact point on the ray? Triangulation image 2 image 1 How do we find the exact point on the ray? + camera 1 with matrix camera 2 with matrix

Will the lines intersect? Triangulation image 2 image 1 Find 3D object point Will the lines intersect? camera 1 with matrix camera 2 with matrix

(no single solution due to noise) Triangulation image 2 image 1 Find 3D object point (no single solution due to noise) camera 1 with matrix camera 2 with matrix

Given a set of (noisy) matched points Triangulation Given a set of (noisy) matched points and camera matrices Estimate the 3D point

Can we compute X from a single correspondence x? known known Can we compute X from a single correspondence x?

Can we compute X from two correspondences x and x’? known known Can we compute X from two correspondences x and x’?

Can we compute X from two correspondences x and x’? known known Can we compute X from two correspondences x and x’? yes if perfect measurements

Can we compute X from two correspondences x and x’? known known Can we compute X from two correspondences x and x’? yes if perfect measurements There will not be a point that satisfies both constraints because the measurements are usually noisy Need to find the best fit

How do we solve for unknowns in a similarity relation? (homogeneous coordinate) Also, this is a similarity relation because it involves homogeneous coordinates (homorogeneous coordinate) Same ray direction but differs by a scale factor How do we solve for unknowns in a similarity relation?

How do we solve for unknowns in a similarity relation? (homogeneous coordinate) Also, this is a similarity relation because it involves homogeneous coordinates (inhomogeneous coordinate) Same ray direction but differs by a scale factor How do we solve for unknowns in a similarity relation? Remove scale factor, convert to linear system and solve with SVD.

How do we solve for unknowns in a similarity relation? (homogeneous coordinate) Also, this is a similarity relation because it involves homogeneous coordinates (inhomogeneous coordinate) Same ray direction but differs by a scale factor How do we solve for unknowns in a similarity relation? Remove scale factor, convert to linear system and solve with SVD!

cross product of two vectors in the same direction is zero Recall: Cross Product Vector (cross) product takes two vectors and returns a vector perpendicular to both cross product of two vectors in the same direction is zero remember this!!!

Same direction but differs by a scale factor Cross product of two vectors of same direction is zero (this equality removes the scale factor)

Using the fact that the cross product should be zero Third line is a linear combination of the first and second lines. (x times the first line plus y times the second line) One 2D to 3D point correspondence give you 2 equations

Using the fact that the cross product should be zero Third line is a linear combination of the first and second lines. (x times the first line plus y times the second line) One 2D to 3D point correspondence give you 2 equations

Now we can make a system of linear equations (two lines for each 2D point correspondence)

Concatenate the 2D points from both images sanity check! dimensions? How do we solve homogeneous linear system?

S V D ! Concatenate the 2D points from both images How do we solve homogeneous linear system? S V D !

Recall: Total least squares (Warning: change of notation. x is a vector of parameters!) (matrix form) constraint minimize minimize subject to (Rayleigh quotient) Solution is the eigenvector corresponding to smallest eigenvalue of

estimate Structure Motion Measurements Pose Estimation Triangulation (scene geometry) Motion (camera geometry) Measurements Pose Estimation known estimate 3D to 2D correspondences Triangulation 2D to 2D coorespondences Reconstruction

Epipolar geometry

Tie tiny threads on HERB and pin them to your eyeball What would it look like?

What does the second observer see? You see points on HERB What does the second observer see?

Second person sees lines You see points on HERB Second person sees lines

This is Epipolar Geometry

Epipole Epipolar lines

Epipolar geometry Image plane

Epipolar geometry Baseline Image plane

Epipolar geometry Baseline Epipole Image plane (projection of o’ on the image plane)

Epipolar geometry Epipolar plane Baseline Baseline Epipole Image plane (projection of o’ on the image plane)

Epipolar geometry Epipolar line Epipolar plane Baseline Epipole (intersection of Epipolar plane and image plane) Epipolar plane Baseline Image plane Epipole (projection of o’ on the image plane)

Quiz What is this?

Quiz Epipolar plane

Quiz What is this? Epipolar plane

Quiz Epipolar line Epipolar plane (intersection of Epipolar plane and image plane) Epipolar plane

Quiz Epipolar line Epipolar plane What is this? (intersection of Epipolar plane and image plane) Epipolar plane What is this?

Quiz Epipolar line Epipolar plane Epipole (intersection of Epipolar plane and image plane) Epipolar plane Epipole (projection of o’ on the image plane)

Quiz Epipolar line Epipolar plane What is this? Epipole (intersection of Epipolar plane and image plane) Epipolar plane What is this? Epipole (projection of o’ on the image plane)

Quiz Epipolar line Epipolar plane Baseline Epipole (intersection of Epipolar plane and image plane) Epipolar plane Baseline Epipole (projection of o’ on the image plane)

lie on the epipolar line Epipolar constraint Potential matches for lie on the epipolar line

lie on the epipolar line Epipolar constraint Potential matches for lie on the epipolar line

The point x (left image) maps to a ___________ in the right image The baseline connects the ___________ and ____________ An epipolar line (left image) maps to a __________ in the right image An epipole e is a projection of the ______________ on the image plane All epipolar lines in an image intersect at the ______________

Where is the epipole in this image? Converging cameras Where is the epipole in this image?

Converging cameras here! Where is the epipole in this image? It’s not always in the image

Parallel cameras Where is the epipole?

Parallel cameras epipole at infinity

Forward moving camera

Forward moving camera

What do the epipolar lines look like? Where is the epipole? What do the epipolar lines look like?

Epipole has same coordinates in both images. Points move along lines radiating from “Focus of expansion”

Task: Match point in left image to point in right image The epipolar constraint is an important concept for stereo vision Task: Match point in left image to point in right image Left image Right image How would you do it?

Recall:Epipolar constraint Potential matches for lie on the epipolar line

Task: Match point in left image to point in right image The epipolar constraint is an important concept for stereo vision Task: Match point in left image to point in right image Left image Right image Want to avoid search over entire image Epipolar constraint reduces search to a single line

Task: Match point in left image to point in right image The epipolar constraint is an important concept for stereo vision Task: Match point in left image to point in right image Left image Right image Want to avoid search over entire image Epipolar constraint reduces search to a single line How do you compute the epipolar line?

The essential matrix

Recall:Epipolar constraint Potential matches for lie on the epipolar line

Given a point in one image, multiplying by the essential matrix will tell us the epipolar line in the second view.

Motivation The Essential Matrix is a 3 x 3 matrix that encodes epipolar geometry Given a point in one image, multiplying by the essential matrix will tell us the epipolar line in the second view.

If the point is on the epipolar line then Representing the … Epipolar Line in vector form If the point is on the epipolar line then

If the point is on the epipolar line then in vector form If the point is on the epipolar line then

dot product of two orthogonal vectors is zero Recall: Dot Product dot product of two orthogonal vectors is zero

vector representing the line is normal (orthogonal) to the plane vector representing the point x is inside the plane Therefore:

So if and then

So if and then

Essential Matrix vs Homography What’s the difference between the essential matrix and a homography?

Essential Matrix vs Homography What’s the difference between the essential matrix and a homography? They are both 3 x 3 matrices but … Essential matrix maps a point to a line Homography maps a point to a point

Where does the Essential matrix come from?

Does this look familiar?

Camera-camera transform just like world-camera transform

These three vectors are coplanar

If these three vectors are coplanar then

If these three vectors are coplanar then

Recall: Cross Product Vector (cross) product takes two vectors and returns a vector perpendicular to both

If these three vectors are coplanar then

If these three vectors are coplanar then

putting it together rigid motion coplanarity

Can also be written as a matrix multiplication Cross product Can also be written as a matrix multiplication Skew symmetric

putting it together rigid motion coplanarity

putting it together rigid motion coplanarity

putting it together rigid motion coplanarity

putting it together rigid motion coplanarity Essential Matrix [Longuet-Higgins 1981]

properties of the E matrix Longuet-Higgins equation (points in normalized coordinates)

properties of the E matrix Longuet-Higgins equation Epipolar lines (points in normalized coordinates)

properties of the E matrix Longuet-Higgins equation Epipolar lines Epipoles (points in normalized camera coordinates)

Recall:Epipolar constraint Potential matches for lie on the epipolar line

Given a point in one image, multiplying by the essential matrix will tell us the epipolar line in the second view. Assumption: points aligned to camera coordinate axis (calibrated camera)

How do you generalize to uncalibrated cameras?

The fundamental matrix

where the assumption of Fundamental matrix is a generalization of the Essential matrix, where the assumption of calibrated cameras is removed

The Essential matrix operates on image points expressed in normalized coordinates (points have been aligned (normalized) to camera coordinates) image point camera point

The Essential matrix operates on image points expressed in normalized coordinates (points have been aligned (normalized) to camera coordinates) image point camera point Writing out the epipolar constraint in terms of image coordinates

Same equation works in image coordinates! it maps pixels to epipolar lines

properties of the E matrix Longuet-Higgins equation Epipolar lines F F F F Epipoles (points in image coordinates)

Breaking down the fundamental matrix Depends on both intrinsic and extrinsic parameters

Breaking down the fundamental matrix Depends on both intrinsic and extrinsic parameters How would you solve for F?

The 8-point algorithm

Assume you have M matched image points Each correspondence should satisfy How would you solve for the 3 x 3 F matrix?

Assume you have M matched image points Each correspondence should satisfy How would you solve for the 3 x 3 F matrix? S V D

Assume you have M matched image points Each correspondence should satisfy How would you solve for the 3 x 3 F matrix? Set up a homogeneous linear system with 9 unknowns

How many equation do you get from one correspondence?

ONE correspondence gives you ONE equation

Set up a homogeneous linear system with 9 unknowns How many equations do you need?

Hence, the 8 point algorithm! Each point pair (according to epipolar constraint) contributes only one scalar equation Note: This is different from the Homography estimation where each point pair contributes 2 equations. We need at least 8 points Hence, the 8 point algorithm!

How do you solve a homogeneous linear system?

How do you solve a homogeneous linear system? Total Least Squares minimize subject to

How do you solve a homogeneous linear system? Total Least Squares minimize subject to S V D !

Eight-Point Algorithm 0. (Normalize points) Construct the M x 9 matrix A Find the SVD of A Entries of F are the elements of column of V corresponding to the least singular value 4. (Enforce rank 2 constraint on F) 5. (Un-normalize F)

Eight-Point Algorithm 0. (Normalize points) Construct the M x 9 matrix A Find the SVD of A Entries of F are the elements of column of V corresponding to the least singular value 4. (Enforce rank 2 constraint on F) 5. (Un-normalize F) See Hartley-Zisserman for why we do this

Eight-Point Algorithm 0. (Normalize points) Construct the M x 9 matrix A Find the SVD of A Entries of F are the elements of column of V corresponding to the least singular value 4. (Enforce rank 2 constraint on F) 5. (Un-normalize F) How do we do this?

Eight-Point Algorithm 0. (Normalize points) Construct the M x 9 matrix A Find the SVD of A Entries of F are the elements of column of V corresponding to the least singular value 4. (Enforce rank 2 constraint on F) 5. (Un-normalize F) How do we do this? S V D !

Enforcing rank constraints Problem: Given a matrix F, find the matrix F’ of rank k that is closest to F, min 𝐹 ′ rank 𝐹 ′ =𝑘 𝐹− 𝐹 ′ 2 Solution: Compute the singular value decomposition of F, 𝐹=𝑈Σ 𝑉 𝑇 Form a matrix Σ’ by replacing all but the k largest singular values in Σ with 0. Then the problem solution is the matrix F’ formed as, 𝐹 ′ =𝑈 Σ ′ 𝑉 𝑇

Eight-Point Algorithm 0. (Normalize points) Construct the M x 9 matrix A Find the SVD of A Entries of F are the elements of column of V corresponding to the least singular value 4. (Enforce rank 2 constraint on F) 5. (Un-normalize F)

Example

epipolar lines

How would you compute it? Where is the epipole? How would you compute it?

How would you solve for the epipole? The epipole is in the right null space of F How would you solve for the epipole? (hint: this is a homogeneous linear system)

S V D ! How would you solve for the epipole? The epipole is in the right null space of F How would you solve for the epipole? (hint: this is a homogeneous linear system) S V D !

>> [u,d] = eigs(F’ * F) u = -0.0013 0.2586 -0.9660 -0.0013 0.2586 -0.9660 0.0029 -0.9660 -0.2586 1.0000 0.0032 -0.0005 d = 1.0e8* -1.0000 0 0 0 -0.0000 0 0 0 -0.0000 eigenvectors eigenvalue

>> [u,d] = eigs(F’ * F) u = -0.0013 0.2586 -0.9660 -0.0013 0.2586 -0.9660 0.0029 -0.9660 -0.2586 1.0000 0.0032 -0.0005 d = 1.0e8* -1.0000 0 0 0 -0.0000 0 0 0 -0.0000 eigenvectors eigenvalue

>> [u,d] = eigs(F’ * F) u = -0.0013 0.2586 -0.9660 -0.0013 0.2586 -0.9660 0.0029 -0.9660 -0.2586 1.0000 0.0032 -0.0005 d = 1.0e8* -1.0000 0 0 0 -0.0000 0 0 0 -0.0000 eigenvectors eigenvalue >> uu = u(:,3) ( -0.9660 -0.2586 -0.0005) Eigenvector associated with smallest eigenvalue

>> [u,d] = eigs(F’ * F) u = -0.0013 0.2586 -0.9660 -0.0013 0.2586 -0.9660 0.0029 -0.9660 -0.2586 1.0000 0.0032 -0.0005 d = 1.0e8* -1.0000 0 0 0 -0.0000 0 0 0 -0.0000 eigenvectors eigenvalue >> uu = u(:,3) ( -0.9660 -0.2586 -0.0005) Eigenvector associated with smallest eigenvalue >> uu / uu(3) (1861.02 498.21 1.0) Epipole projected to image coordinates

>> uu / uu(3) (1861.02 498.21 1.0) epipole (1861.02 498.21 1.0) Epipole projected to image coordinates

References Ch Basic reading: Szeliski textbook, Sections 7.1, 7.2, 11.1. Hartley and Zisserman, Chapters 9, 11, 12. Ch