structure from motion and optical flow
play

Structure from Motion and Optical Flow Various slides from previous - PowerPoint PPT Presentation

CS4501: Introduction to Computer Vision Structure from Motion and Optical Flow Various slides from previous courses by: D.A. Forsyth (Berkeley / UIUC), I. Kokkinos (Ecole Centrale / UCL). S. Lazebnik (UNC / UIUC), S. Seitz (MSR / Facebook), J.


  1. CS4501: Introduction to Computer Vision Structure from Motion and Optical Flow Various slides from previous courses by: D.A. Forsyth (Berkeley / UIUC), I. Kokkinos (Ecole Centrale / UCL). S. Lazebnik (UNC / UIUC), S. Seitz (MSR / Facebook), J. Hays (Brown / Georgia Tech), A. Berg (Stony Brook / UNC), D. Samaras (Stony Brook) . J. M. Frahm (UNC), V. Ordonez (UVA), Steve Seitz (UW).

  2. Last Class • More on Epipolar Geometry • Essential Matrix • Fundamental Matrix

  3. Today’s Class • More on Epipolar Geometry • Essential Matrix • Fundamental Matrix • Optical Flow

  4. Estimating depth with stereo • Stereo : shape from “motion” between two views • We’ll need to consider: • Info on camera pose (“calibration”) • Image point correspondences scene point image plane optical center

  5. Key idea: Epipolar constraint X X X x x ’ x ’ x ’ Potential matches for x have to lie on the corresponding line l’ . Potential matches for x’ have to lie on the corresponding line l .

  6. Epipolar geometry: notation X x x ’ • Baseline – line connecting the two camera centers • Epipoles = intersections of baseline with image planes = projections of the other camera center • Epipolar Plane – plane containing baseline (1D family)

  7. Epipolar geometry: notation X x x ’ • Baseline – line connecting the two camera centers • Epipoles = intersections of baseline with image planes = projections of the other camera center • Epipolar Plane – plane containing baseline (1D family) • Epipolar Lines - intersections of epipolar plane with image planes (always come in corresponding pairs)

  8. Epipolar Geometry: Another example Credit: William Hoff, Colorado School of Mines

  9. Example: Converging cameras

  10. Geometry for a simple stereo system • First, assuming parallel optical axes, known camera parameters (i.e., calibrated cameras):

  11. 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

  12. Geometry for a simple stereo system • Assume parallel optical axes, known camera parameters (i.e., calibrated cameras). What is expression for Z? Similar triangles (p l , P, p r ) and (O l , P, O r ): + - T x x T = l r - Z f Z T = Z f - x x r l disparity

  13. Depth from disparity image I´(x´,y´) image I(x,y) Disparity map D(x,y) (x´,y´)=(x+D(x,y), y) So if we could find the corresponding points in two images, we could estimate relative depth …

  14. 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

  15. Correspondence search Left Right scanline SSD

  16. Correspondence search Left Right scanline Norm. corr

  17. 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 ) = B * f /( x–x’ )

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

  19. Active stereo with structured light •Project “structured” light patterns onto the object • Simplifies the correspondence problem • Allows us to use only one camera camera projector L. Zhang, B. Curless, and S. M. Seitz. Rapid Shape Acquisition Using Color Structured Light and Multi-pass Dynamic Programming. 3DPVT 2002

  20. Kinect and Iphone X Solution • Add Texture!

  21. Kinect: Structured infrared light http://bbzippo.wordpress.com/2010/11/28/kinect-in-infrared/

  22. iPhone X

  23. 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 ) = B * f /( x–x’ )

  24. Effect of window size W = 3 W = 20 • Smaller window + More detail • More noise • Larger window + Smoother disparity maps • Less detail

  25. Results with window search Data Window-based matching Ground truth

  26. Better methods exist... 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/

  27. When cameras are not aligned: Stereo image rectification • Reproject image planes onto a common plane parallel to the line between optical 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 .

  28. Rectification example

  29. Back to the General Problem Credit: William Hoff, Colorado School of Mines

  30. Back to the General Problem Credit: William Hoff, Colorado School of Mines

  31. Back to the General Problem Credit: William Hoff, Colorado School of Mines

  32. Back to the General Problem Credit: William Hoff, Colorado School of Mines

  33. Back to the General Problem Credit: William Hoff, Colorado School of Mines

  34. Back to the General Problem Credit: William Hoff, Colorado School of Mines

  35. Back to the General Problem Credit: William Hoff, Colorado School of Mines

  36. Brief Digression: Cross Product as Matrix Multiplication • Dot Product as matrix multiplication: Easy ! " ! $ ! % & ' " ' $ ' % = ! " ' " + ! $ ' $ + ! % ' % ! " ! $ ! % ' " ' $ ' % * = ! " ' " + ! $ ' $ + ! % ' % • Cross Product as matrix multiplication:

  37. Back to the General Problem Credit: William Hoff, Colorado School of Mines

  38. The Essential Matrix

  39. The Essential Matrix Essential Matrix (Longuet-Higgins, 1981) Credit: William Hoff, Colorado School of Mines

  40. Epipolar constraint: Calibrated case X x x ’ • Intrinsic and extrinsic parameters of the cameras are known, world coordinate system is set to that of the first camera • Then the projection matrices are given by K [ I | 0] and K ’[ R | t ] • We can multiply the projection matrices (and the image points) by the inverse of the calibration matrices to get normalized image coordinates: ¢ ¢ ¢ = - = = - = 1 1 x K x [ I 0] X, x K x [ R t ] X norm pixel norm pixel

  41. Epipolar constraint: Calibrated case X = ( x, 1) T æ x ö æ x ö [ ] [ ] ç ÷ ç ÷ I 0 R t ç ÷ ç ÷ 1 1 è ø è ø x x’ = Rx+t t R The vectors Rx , t , and x’ are coplanar

  42. Epipolar constraint: Calibrated case X x x’ = Rx+t ¢ × ´ = x T [ t × ] Rx = 0 x [ t ( R x ) ] 0 ! é - ù 0 a a é b ù z y x ê ú ê ú ´ = - = a b a 0 a b [ a ] b Recall: ê ú ê ú ´ z x y ê ú ê ú - a a 0 b ë û ë û y x z The vectors Rx , t , and x’ are coplanar

  43. Epipolar constraint: Calibrated case X x x’ = Rx+t ¢ × ´ = x T [ t × ] Rx = 0 x T E x = 0 x [ t ( R x ) ] 0 ! ! Essential Matrix (Longuet-Higgins, 1981) The vectors Rx , t , and x’ are coplanar

  44. Epipolar constraint: Calibrated case X x x ’ x T E x = 0 ! • E x is the epipolar line associated with x ( l ' = E x ) • Recall: a line is given by ax + by + c = 0 or é ù é ù a x ê ú ê ú = = = T l x 0 where l b , x y ê ú ê ú ê ú ê ú c 1 ë û ë û

  45. Epipolar constraint: Calibrated case X x x ’ x T E x = 0 ! • E x is the epipolar line associated with x ( l ' = E x ) • E T x ' is the epipolar line associated with x' ( l = E T x ' ) • E e = 0 and E T e ' = 0 • E is singular (rank two) • E has five degrees of freedom

  46. Epipolar constraint: Uncalibrated case X x x ’ •The calibration matrices K and K ’ of the two cameras are unknown •We can write the epipolar constraint in terms of unknown normalized coordinates: ¢ ¢ ¢ = - = - ¢ 1 1 = ˆ ˆ x T x K x , x K x ˆ ˆ E x 0

  47. Epipolar constraint: Uncalibrated case X x x ’ ¢ ¢ ¢ = = = - - x T ˆ ˆ T T 1 E x 0 x F x 0 with F K E K - = ˆ 1 x K x Fundamental Matrix ¢ ¢ - ¢ = ˆ 1 x K x (Faugeras and Luong, 1992)

  48. Epipolar constraint: Uncalibrated case X x x ’ ¢ ¢ ¢ = = = - - x T ˆ ˆ T T 1 E x 0 x F x 0 with F K E K • F x is the epipolar line associated with x ( l ' = F x ) • F T x ' is the epipolar line associated with x' ( l = F T x ' ) • F e = 0 and F T e ' = 0 • F is singular (rank two) • F has seven degrees of freedom

Recommend


More recommend