Lecture 8: Stereo.

Slides:



Advertisements
Similar presentations
Epipolar Geometry.
Advertisements

Lecture 11: Two-view geometry
Stereo Vision Reading: Chapter 11
Gratuitous Picture US Naval Artillery Rangefinder from World War I (1918)!!
Stereo Many slides adapted from Steve Seitz. Binocular stereo Given a calibrated binocular stereo pair, fuse it to produce a depth image Where does the.
Stereo and Projective Structure from Motion
Jan-Michael Frahm, Enrique Dunn Spring 2012
Two-view geometry.
Recap from Previous Lecture Tone Mapping – Preserve local contrast or detail at the expense of large scale contrast. – Changing the brightness within.
Stereo.
776 Computer Vision Jan-Michael Frahm, Enrique Dunn Spring 2012.
Camera calibration and epipolar geometry
Structure from motion.
Last Time Pinhole camera model, projection
Multiple View Geometry : Computational Photography Alexei Efros, CMU, Fall 2005 © Martin Quinn …with a lot of slides stolen from Steve Seitz and.
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.
Lecture 21: Multiple-view geometry and structure from motion
Stereopsis Mark Twain at Pool Table", no date, UCR Museum of Photography.
The plan for today Camera matrix
Stereo and Structure from Motion
Lecture 20: Two-view geometry CS6670: Computer Vision Noah Snavely.
Lec 21: Fundamental Matrix
CSE473/573 – Stereo Correspondence
Announcements PS3 Due Thursday PS4 Available today, due 4/17. Quiz 2 4/24.
Multiple View Geometry : Computational Photography Alexei Efros, CMU, Fall 2006 © Martin Quinn …with a lot of slides stolen from Steve Seitz and.
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,
9 – Stereo Reconstruction
Multi-view geometry. Multi-view geometry problems Structure: Given projections of the same 3D point in two or more images, compute the 3D coordinates.
Computer Vision Spring ,-685 Instructor: S. Narasimhan WH 5409 T-R 10:30am – 11:50am Lecture #15.
Stereo Readings Trucco & Verri, Chapter 7 –Read through 7.1, 7.2.1, 7.2.2, 7.3.1, 7.3.2, and 7.4, –The rest is optional. Single image stereogram,
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,
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.
Structure from images. Calibration Review: Pinhole Camera.
Multi-view geometry.
Lecture 12 Stereo Reconstruction II Lecture 12 Stereo Reconstruction II Mata kuliah: T Computer Vision Tahun: 2010.
Recap from Monday Image Warping – Coordinate transforms – Linear transforms expressed in matrix form – Inverse transforms useful when synthesizing images.
Epipolar geometry Epipolar Plane Baseline Epipoles Epipolar Lines
Stereo Vision Reading: Chapter 11 Stereo matching computes depth from two or more images Subproblems: –Calibrating camera positions. –Finding all corresponding.
Stereo Readings Szeliski, Chapter 11 (through 11.5) Single image stereogram, by Niklas EenNiklas Een.
Stereo Many slides adapted from Steve Seitz.
Stereo Many slides adapted from Steve Seitz. Binocular stereo Given a calibrated binocular stereo pair, fuse it to produce a depth image image 1image.
Computer Vision, Robert Pless
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.
CSE 185 Introduction to Computer Vision Stereo. Taken at the same time or sequential in time stereo vision structure from motion optical flow Multiple.
Bahadir K. Gunturk1 Phase Correlation Bahadir K. Gunturk2 Phase Correlation Take cross correlation Take inverse Fourier transform  Location of the impulse.
Two-view geometry. Epipolar Plane – plane containing baseline (1D family) Epipoles = intersections of baseline with image planes = projections of the.
stereo Outline : Remind class of 3d geometry Introduction
Feature Matching. Feature Space Outlier Rejection.
776 Computer Vision Jan-Michael Frahm Spring 2012.
Solving for Stereo Correspondence Many slides drawn from Lana Lazebnik, UIUC.
Project 2 due today Project 3 out today Announcements TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAA.
Multiple View Geometry and Stereo. Overview Single camera geometry – Recap of Homogenous coordinates – Perspective projection model – Camera calibration.
CSE 185 Introduction to Computer Vision Stereo 2.
Multi-view geometry. Multi-view geometry problems Structure: Given projections of the same 3D point in two or more images, compute the 3D coordinates.
Epipolar Geometry and Stereo Vision
Stereo CSE 455 Linda Shapiro.
CS4670 / 5670: Computer Vision Kavita Bala Lec 27: Stereo.
CSE 455 Ali Farhadi Several slides from Larry Zitnick and Steve Seitz
Stereo and Structure from Motion
Epipolar geometry.
3D Photography: Epipolar geometry
Reconstruction.
Two-view geometry.
Two-view geometry.
Multi-view geometry.
Stereo vision Many slides adapted from Steve Seitz.
Presentation transcript:

Lecture 8: Stereo

Depth from Stereo Goal: recover depth by finding image coordinate x’ that corresponds to x X x x' f x x’ Baseline B z C C’ X

Depth from Stereo Goal: recover depth by finding image coordinate x’ that corresponds to x Problems Calibration: How do we recover the relation of the cameras (if not already known)? Correspondence: How do we search for the matching point x’? X x x' f x x’ Baseline B z C C’ X

Correspondence Problem We have two images taken from cameras at different positions How do we match a point in the first image to a point in the second? What constraints do we have?

A pre-sequitor Fun with vectors. Let a and b be two vectors. What is a (dot) b? What is a (cross) b? Quiz: What is a (dot) a? (what is the data type?) What is a (cross) a?

Recap, Camera Calibration. Projection from the world to the image: Calibration Rotation Translation Homogeneous equal, “equal up to a scale factor” Computer Vision, Robert Pless

Idea of today… Today we are going to characterize the geometry of how two cameras look at a scene… but perhaps a more complicated. And by scene, we mean, at first, just one point. Computer Vision, Robert Pless

Epipolar Constraint There are 3 degrees of freedom in the position of a point in space; there are four DOF for image points in two planes… Where does that fourth DOF go? Computer Vision, Robert Pless

Epipolar Lines Potential 3d points Red point - fixed => Blue point lies on a line Each point in one image corresponds to a line of possibilities in the other. “Epipolar Line” Computer Vision, Robert Pless

Epipolar Geometry => Red point lies on a line baseline Blue point - fixed An epipole is the image point of the other camera’s center. All epipolar lines meet at the epipoles. Epipoles lie on the cameras’ baseline. Computer Vision, Robert Pless Is there other structure available among epipolar lines?

Another look (with math). We have two images, with a point in one and the epi-polar line in the other. Lets take away the image plane, and just leave the image centers. Computer Vision, Robert Pless

Another look (with math). Computer Vision, Robert Pless

Another look (with math). a translation vector defining where one camera is relative to the other. Computer Vision, Robert Pless

Another look (with math). a translation vector defining where one camera is relative to the other. Computer Vision, Robert Pless

Another look (with math). A point on one image lies on ray in space with direction Computer Vision, Robert Pless

Another look (with math). Which rays from, the second camera center might intersect ray p? Computer Vision, Robert Pless

Another look (with math). Those rays lie in the plane defined by the ray in space and the second camera center. Computer Vision, Robert Pless

Another look (with math). - normal of the plane is perpendicular to both p and t. Math fact: a x b is a vector perpendicular to a and b. Computer Vision, Robert Pless

Another look (with math). All lines in the plane are perpendicular to the normal to normal to the plane. Math fact. aTb = 0 if a is perpendicular to b Computer Vision, Robert Pless

Putting it all together. Fact: Cameras separated by translation t Ray from one camera center in direction p Ray from second camera center q Computer Vision, Robert Pless

Lets put the images back in. y x P is relative to some coordinate system. Computer Vision, Robert Pless

y x y x q is relative to some coordinate system, but that camera may have rotated. So the q in the first coordinate system is some rotation times the q measured in the second coordinate system Computer Vision, Robert Pless

All three vectors in the same plane: y x y x All three vectors in the same plane: Computer Vision, Robert Pless

Put images even more back in. (x,y) K maps normalized coordinates onto pixel coordinates. Given pixel coordinates (x,y), K-1 remaps those to a direction from the camera center. Computer Vision, Robert Pless

Normalized camera system, epipolar equation. “Uncalibrated” Case, epipolar equation: F is the “fundamental matrix”. Computer Vision, Robert Pless

(x,y) that correspond to (x’,y’). Using the equation… Click on “the same world point” in the left and right image, to get a set of point correspondences: (x,y) that correspond to (x’,y’). Need at least 8 points (each point gives one constraint, F is 3x3, but scale invariant, so there are 8 degrees of freedom in F). Computer Vision, Robert Pless

So what… how to use F Potential 3d points Red point - fixed => Blue point lies on a line Given a point (x,y) on the left image, F defines the “Epipolar Line” and tells where the corresponding points must lie. How is that line defined? Only easy in homogenous coordinates! Computer Vision, Robert Pless

Examples Computer Vision, Robert Pless http://www-sop.inria.fr/robotvis/personnel/sbougnou/Meta3DViewer/EpipolarGeo.html

Examples Computer Vision, Robert Pless

Examples Geometrically, why do all epipolar lines intersect? Computer Vision, Robert Pless Geometrically, why do all epipolar lines intersect?

Estimating the Fundamental Matrix 8-point algorithm Least squares solution using SVD on equations from 8 pairs of correspondences Enforce det(F)=0 constraint using SVD on F Minimize reprojection error Non-linear least squares

8-point algorithm Solve a system of homogeneous linear equations Write down the system of equations

8-point algorithm Solve a system of homogeneous linear equations Write down the system of equations Solve f from Af=0 using SVD Matlab: [U, S, V] = svd(A); f = V(:, end); F = reshape(f, [3 3])’;

Need to enforce singularity constraint

8-point algorithm Solve a system of homogeneous linear equations Write down the system of equations Solve f from Af=0 using SVD Resolve det(F) = 0 constraint by SVD Matlab: [U, S, V] = svd(A); f = V(:, end); F = reshape(f, [3 3])’; Matlab: [U, S, V] = svd(F); S(3,3) = 0; F = U*S*V’;

8-point algorithm Solve a system of homogeneous linear equations Write down the system of equations Solve f from Af=0 using SVD Resolve det(F) = 0 constraint by SVD Notes: Use RANSAC to deal with outliers (sample 8 points) Solve in normalized coordinates mean=0 RMS distance = (1,1,1) This also help estimating the homography for stitching

Comparison of homography estimation and the 8-point algorithm Assume we have matched points x x’ with outliers Homography (No Translation) Fundamental Matrix (Translation)

Comparison of homography estimation and the 8-point algorithm Assume we have matched points x x’ with outliers Homography (No Translation) Fundamental Matrix (Translation) Correspondence Relation RANSAC with 4 points

Comparison of homography estimation and the 8-point algorithm Assume we have matched points x x’ with outliers Homography (No Translation) Fundamental Matrix (Translation) Correspondence Relation RANSAC with 4 points Correspondence Relation RANSAC with 8 points Enforce by SVD

So Given 2 images. Can find the relative translation and rotations of the cameras. How do we find depth?

Simplest Case: Parallel images Image planes of cameras are parallel to each other and to the baseline Camera centers are at same height Focal lengths are the same Then, epipolar lines fall along the horizontal scan lines of the images

Depth from disparity X z x x’ f f O Baseline B O’ Disparity is inversely proportional to depth.

Stereo image rectification

Stereo image rectification Reproject image planes onto a common plane parallel to the line between camera centers Pixel motion is horizontal after this transformation Two homographies (3x3 transform), one for each input image reprojection C. Loop and Z. Zhang. Computing Rectifying Homographies for Stereo Vision. IEEE Conf. Computer Vision and Pattern Recognition, 1999.

Rectification example

Basic stereo matching algorithm If necessary, rectify the two stereo images to transform epipolar lines into scanlines For each pixel x in the first image Find corresponding epipolar scanline in the right image Examine all pixels on the scanline and pick the best match x’ Compute disparity x-x’ and set depth(x) = fB/(x-x’)

Correspondence search Left Right scanline Matching cost disparity Slide a window along the right scanline and compare contents of that window with the reference window in the left image Matching cost: SSD or normalized correlation

Correspondence search Left Right scanline SSD

Correspondence search Left Right scanline Norm. corr

Effect of window size Smaller window Larger window + More detail More noise Larger window + Smoother disparity maps Less detail smaller window: more detail, more noise bigger window: less noise, more detail

Failures of correspondence search Occlusions, repetition Textureless surfaces Non-Lambertian surfaces, specularities

Results with window search Data Window-based matching Ground truth

How can we improve window-based matching? So far, matches are independent for each point What constraints or priors can we add?

Stereo constraints/priors Uniqueness For any point in one image, there should be at most one matching point in the other image

Stereo constraints/priors Uniqueness For any point in one image, there should be at most one matching point in the other image Ordering Corresponding points should be in the same order in both views

Stereo constraints/priors Uniqueness For any point in one image, there should be at most one matching point in the other image Ordering Corresponding points should be in the same order in both views Ordering constraint doesn’t hold

Priors and constraints Uniqueness For any point in one image, there should be at most one matching point in the other image Ordering Corresponding points should be in the same order in both views Smoothness We expect disparity values to change slowly (for the most part)

Stereo matching as energy minimization D W1(i ) W2(i+D(i )) D(i ) Energy functions of this form can be minimized using graph cuts Y. Boykov, O. Veksler, and R. Zabih, Fast Approximate Energy Minimization via Graph Cuts, PAMI 2001

Many of these constraints can be encoded in an energy function and solved using graph cuts Before Graph cuts Ground truth Y. Boykov, O. Veksler, and R. Zabih, Fast Approximate Energy Minimization via Graph Cuts, PAMI 2001 For the latest and greatest: http://www.middlebury.edu/stereo/

Summary Epipolar geometry Stereo depth estimation Epipoles are intersection of baseline with image planes Matching point in second image is on a line passing through its epipole Fundamental matrix maps from a point in one image to a line (its epipolar line) in the other Can solve for F given corresponding points (e.g., interest points) Can recover canonical camera matrices from F (with projective ambiguity) Stereo depth estimation Estimate disparity by finding corresponding points along scanlines Depth is inverse to disparity

Next class: structure from motion

But first, Project 2.