Presentation on theme: "Optical Flow Estimation"— Presentation transcript:
1 Optical Flow Estimation Lucas-Kanade Algorithm and its ExtensionsMany slides from Alexei Efros ans Steve Seitz
2 2-D Motion ≠ Optical Flow 2-D Motion: Projection of 3-D motion, depending on 3D object motion and projection model.Optical flow: “Perceived” 2-D motion based on changes in image patterns, also depends on illumination and object surface texture.Nevertheless, people often use these two terms interchangeably.Static sphere, changing illuminationSpinning sphere, static illumination
4 Problem Definition: Optical Flow How to estimate pixel motion from image H to image I?Why is it usefulDepth (3D) reconstructionMotion detection - tracking moving objectsCompressionMosaicsAnd more…
5 Problem Definition: Optical Flow How to estimate pixel motion from image H to image I?Solve pixel correspondence problemgiven a pixel in H, look for nearby pixels of the same color in IKey assumptionscolor constancy: a point in H looks the same in IFor grayscale images, this is brightness constancysmall motion: points do not move very farThis is called the optical flow problem
6 Motion estimation: Optical flow Goal: estimate the motion of each pixel
7 Classes of Techniques Feature-based methods Direct-methods Extract visual features (corners, textured areas) and track them over multiple framesSparse motion fields, but possibly robust trackingSuitable especially when image motion is large (10-s of pixels)Direct-methodsDirectly recover image motion from spatio-temporal image brightness variationsMotion vectors directly recovered without an intermediate feature extraction stepDense motion fields, but more sensitive to appearance variationsSuitable for video and when image motion is small (< 10 pixels)
8 Optical flow constraints (grayscale images) Let’s take a closer look at these constraints:brightness constancy: Q: what’s the equation?H(x,y)=I(x+u,y+v)A: H(x,y) = I(x+u, y+v)small motion: (u and v are less than 1 pixel)suppose we take the Taylor series expansion of I:
9 Optical flow equation Combining these two equations In the limit, as u and v go to zero, this approximation is good
10 Optical flow equation Intuitively, what does this constraint mean? Q: How many equations and how many unknowns do we have per pixel?Intuitively, what does this constraint mean?The component of the flow in the gradient direction is determinedThe component of the flow parallel to an edge is unknownA: u and v are unknown, 1 equationThis explains the Barber Pole illusion
11 Getting more Equations How to get more equations for a pixel?Basic idea: impose additional constraintsmost common is to assume that the flow field is smooth locallyone method: assume the pixel’s neighbors have the same (u,v)If we use a 5x5 window, this gives us 25 equations per pixel!
12 Lukas-Kanade Scheme We have over constrained equation set: Solution: solve least squares problemminimum least squares solution given by solution (in d) of:The summations are over all pixels in the K x K windowThis technique was first proposed by Lukas & Kanade (1981)
13 When can we solve this ? When is This Solvable? Optimal (u, v) satisfies Lucas-Kanade equationWhen is This Solvable?ATA should be invertibleThe eigenvalues of ATA should not be too small (noise)ATA should be well-conditionedl1/ l2 should not be too large (l1 = larger eigenvalue)ATA is invertible when there is no aperture problem
17 The Aperture Problem and Let Algorithm: At each pixel compute by solvingM is singular if all gradient vectors point in the same directione.g., along an edgeof course, trivially singular if the summation is over a single pixel or if there is no texturei.e., only normal flow is available (aperture problem)Corners and textured areas are OK
19 Edgelarge gradients, all the samelarge l1, small l2
20 Low texture regiongradients have small magnitudesmall l1, small l2
21 High textured region gradients are different, large magnitudes large l1, large l2
22 Observation This is a two image problem BUT Can measure sensitivity/uncertainty by just looking at one of the images!This tells us which pixels are easy to track, which are hardvery useful later on when we do feature tracking...
23 Errors in Lukas-Kanade What are the potential causes of errors in this procedure?Suppose ATA is easily invertibleSuppose there is not much noise in the imageWhen our assumptions are violatedBrightness constancy is not satisfiedThe motion is not smallA point does not move like its neighborswindow size is too largewhat is the ideal window size?
24 Iterative Refinement Iterative Lukas-Kanade Algorithm Estimate velocity at each pixel by solving Lucas-Kanade equationsWarp H towards I using the estimated flow field- use image warping techniques (easier said than done)Repeat until convergence
25 Optical Flow: Iterative Estimation estimate updateInitial guess:Estimate:x0x(using d for displacement here instead of u)
29 Optical Flow: Iterative Estimation Some Implementation Issues: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)
30 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?actual shiftestimated shiftnearest match is correct (no aliasing)nearest match is incorrect (aliasing)To overcome aliasing: coarse-to-fine estimation.
31 Revisiting the small motion assumption Is this motion small enough?Probably not—it’s much larger than one pixel (2nd order terms dominate)How might we solve this problem?
33 Coarse-to-fine optical flow estimation Gaussian pyramid of image HGaussian pyramid of image Iimage Iimage Hu=10 pixelsu=5 pixelsu=2.5 pixelsu=1.25 pixelsimage Himage I
34 Coarse-to-fine optical flow estimation Gaussian pyramid of image HGaussian pyramid of image Iimage Iimage Hrun iterative L-Kwarp & upsamplerun iterative L-K.image Jimage I
35 Multi-resolution Lucas Kanade Algorithm Compute Iterative LK at highest levelFor Each Level iTake flow u(i-1), v(i-1) from level i-1Upsample the flow to create u*(i), v*(i) matrices of twice resolution for level i.Multiply u*(i), v*(i) by 2Compute It from a block displaced by u*(i), v*(i)Apply LK to get u’(i), v’(i) (the correction in flow)Add corrections u’(i), v’(i) to obtain the flow u(i), v(i) at the ith level, i.e., u(i)=u*(i)+u’(i), v(i)=v*(i)+v’(i)
36 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)
Your consent to our cookies if you continue to use this website.