1.09k likes | 1.4k Views
Algorithms & Applications in Computer Vision. Lihi Zelnik -Manor Lecture 9: Optical Flow. Last Time: Alignment. Homographies Rotational Panoramas RANSAC Global alignment Warping Blending. Today: Motion and Flow. Motion estimation Patch-based motion (optic flow)
E N D
Algorithms & Applications in Computer Vision LihiZelnik-Manor Lecture 9: Optical Flow
Last Time: Alignment • Homographies • Rotational Panoramas • RANSAC • Global alignment • Warping • Blending
Today: Motion and Flow • Motion estimation • Patch-based motion (optic flow) • Regularization and line processes • Parametric (global) motion • Layered motion models
Optical Flow Where did each pixel in image 1 go to in image 2
Optical Flow Pierre Kornprobst's Demo
Introduction • Given a video sequence with camera/objects moving we can better understand the scene if we find the motions of the camera/objects.
Scene Interpretation • How is the camera moving? • How many moving objects are there? • Which directions are they moving in? • How fast are they moving? • Can we recognize their type of motion (e.g. walking, running, etc.)?
Applications • Recover camera ego-motion. Result by MobilEye (www.mobileye.com)
Applications • Motion segmentation Result by: L.Zelnik-Manor, M.Machline, M.Irani “Multi-body Segmentation: Revisiting Motion Consistency” To appear, IJCV
Applications • Structure from Motion Input Reconstructed shape Result by: L. Zhang, B. Curless, A. Hertzmann, S.M. Seitz “Shape and motion under varying illumination: Unifying structure from motion, photometric stereo, and multi-view stereo” ICCV’03
Examples of Motion fields Closer objects appear to move faster!! Forward motion Rotation Horizontal translation
CCD 3D motion vector 2D optical flow vector Motion Field & Optical Flow Field • Motion Field = Real world 3D motion • Optical Flow Field = Projection of the motion field onto the 2d image
The screen is stationary yet displays motion Homogeneous objects generate zero optical flow. Fixed sphere. Changing light source. Non-rigid texture motion When does it break?
The Optical Flow Field Still, in many cases it does work…. • Goal:Find for each pixel a velocity vector which says: • How quickly is the pixel moving across the image • In which direction it is moving
Estimating Optical Flow • Assume the image intensity is constant Time = t Time = t+dt
Brightness Constancy Equation First order Taylor Expansion Simplify notations: Gradient and flow are orthogonal Divide by dt and denote: Problem I: One equation, two unknowns
Time t Time t+dt Time t+dt Problem II: “The Aperture Problem” • For points on a line of fixed intensity we can only recover the normal flow ? Where did the blue point move to? We need additional constraints
Use Local Information Sometimes enlarging the aperture can help
Local smoothnessLucas Kanade (1984) Assume constant (u,v) in small neighborhood
Goal: Minimize 2x2 2x1 2x1 Lucas Kanade (1984) Method: Least-Squares
How does Lucas-Kanade behave? We want this matrix to be invertible. i.e., no zero eigenvalues
How does Lucas-Kanade behave? • Edge becomes singular
How does Lucas-Kanade behave? • Homogeneous 0 eigenvalues
How does Lucas-Kanade behave? • Textured regions two high eigenvalues
How does Lucas-Kanade behave? • Edge becomes singular • Homogeneous regions low gradients • High texture
Iterative Refinement • Estimate velocity at each pixel using one iteration of Lucas and Kanade estimation • Warp one image toward the other using the estimated flow field (easier said than done) • Refine estimate by repeating the process
Optical Flow: Iterative Estimation estimate update Initial guess: Estimate: x x0
x x0 Optical Flow: Iterative Estimation estimate update Initial guess: Estimate:
x x0 Optical Flow: Iterative Estimation estimate update Initial guess: Estimate: Initial guess: Estimate:
Optical Flow: Iterative Estimation • Some Implementation Issues: • Warping is not easy (ensure that errors in warping are smaller than the estimate refinement) • Warp one image, take derivatives of the other so you don’t need to re-compute the gradient after each iteration. • Often useful to low-pass filter the images before motion estimation (for better derivative estimation, and linear approximations to image intensity)
Correlation based methods Regularization based methods Use multi-scale estimation Other break-downs • Brightness constancy is not satisfied • A point does not move like its neighbors • what is the ideal window size? • The motion is not small (Taylor expansion doesn’t hold) • Aliasing
actual shift estimated shift Optical Flow: Aliasing Temporal aliasing causes ambiguities in optical flow because images can have many pixels with the same intensity. I.e., how do we know which ‘correspondence’ is correct? nearest match is correct (no aliasing) nearest match is incorrect (aliasing) To overcome aliasing: coarse-to-fine estimation.
u=1.25 pixels u=2.5 pixels u=5 pixels u=10 pixels image It-1 image I Multi-Scale Flow Estimation image It image It+1 Gaussian pyramid of image It Gaussian pyramid of image It+1
warp & upsample run Lucas-Kanade . . . image It-1 image I Multi-Scale Flow Estimation run Lucas-Kanade image It image It+1 Gaussian pyramid of image It Gaussian pyramid of image It+1
Correlation based methods Regularization based methods Use multi-scale estimation Other break-downs • Brightness constancy is not satisfied • A point does not move like its neighbors • what is the ideal window size? • The motion is not small (Taylor expansion doesn’t hold) • Aliasing
Spatial Coherence Assumption * Neighboring points in the scene typically belong to the same surface and hence typically have similar motions. * Since they also project to nearby points in the image, we expect spatial coherence in image flow. Black
Formalize this Idea Noisy 1D signal: u x Noisy measurements p(x) Black
Regularization Find the “best fitting” smoothed function v(x) u q(x) x Noisy measurements p(x) Black
Membrane model Find the “best fitting” smoothed function v(x) u q(x) x Black
Membrane model Find the “best fitting” smoothed function q(x) u q(x) x Black
Membrane model Find the “best fitting” smoothed function q(x) u q(x) Black
Spatial smoothness assumption Faithful to the data Regularization u q(x) x Minimize: Black
Bayesian Interpretation Black
Discontinuities u q(x) x What about this discontinuity? What is happening here? What can we do? Black
velocity space u2 + + u1 Robust Estimation Noise distributions are often non-Gaussian, having much heavier tails. Noise samples from the tails are called outliers. • Sources of outliers (multiple motions): • specularities / highlights • jpeg artifacts / interlacing / motion blur • multiple motions (occlusion boundaries, transparency) Black
Occlusion occlusion disocclusion shear Multiple motions within a finite region. Black
Coherent Motion Possibly Gaussian. Black
Multiple Motions Definitely not Gaussian. Black