Lucas–Kanade Method
   HOME

TheInfoList



OR:

In
computer vision Computer vision is an interdisciplinary scientific field that deals with how computers can gain high-level understanding from digital images or videos. From the perspective of engineering, it seeks to understand and automate tasks that the hum ...
, the Lucas–Kanade method is a widely used differential method for
optical flow Optical flow or optic flow is the pattern of apparent motion of objects, surfaces, and edges in a visual scene caused by the relative motion between an observer and a scene. Optical flow can also be defined as the distribution of apparent veloci ...
estimation developed by Bruce D. Lucas and
Takeo Kanade is a Japanese computer scientist and one of the world's foremost researchers in computer vision. He is Uncas A. Whitaker, U.A. and Helen Whitaker Professor at Carnegie Mellon University. He has approximately 300 peer-reviewed academic publicatio ...
. It assumes that the flow is essentially constant in a local neighbourhood of the
pixel In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the smal ...
under consideration, and solves the basic optical flow equations for all the pixels in that neighbourhood, by the least squares criterion.B. D. Lucas and T. Kanade (1981),
An iterative image registration technique with an application to stereo vision.
' Proceedings of Imaging Understanding Workshop, pages 121--130
Bruce D. Lucas (1984)
Generalized Image Matching by the Method of Differences
' (doctoral dissertation)
By combining information from several nearby pixels, the Lucas–Kanade method can often resolve the inherent ambiguity of the optical flow equation. It is also less sensitive to image noise than point-wise methods. On the other hand, since it is a purely local method, it cannot provide flow information in the interior of uniform regions of the image.


Concept

The Lucas–Kanade method assumes that the displacement of the image contents between two nearby instants (frames) is small and approximately constant within a neighborhood of the point p under consideration. Thus the optical flow equation can be assumed to hold for all pixels within a window centered at p. Namely, the local image flow (velocity) vector (V_x,V_y) must satisfy :I_x(q_1) V_x + I_y (q_1) V_y = -I_t(q_1) :I_x(q_2) V_x + I_y (q_2) V_y = -I_t(q_2) :\vdots :I_x(q_n) V_x + I_y (q_n) V_y = -I_t(q_n) where q_1,q_2,\dots,q_n are the pixels inside the window, and I_x(q_i),I_y(q_i),I_t(q_i) are the partial derivatives of the image I with respect to position x, y and time t, evaluated at the point q_i and at the current time. These equations can be written in
matrix Matrix most commonly refers to: * ''The Matrix'' (franchise), an American media franchise ** ''The Matrix'', a 1999 science-fiction action film ** "The Matrix", a fictional setting, a virtual reality environment, within ''The Matrix'' (franchis ...
form A v = b, where :A = \begin I_x(q_1) & I_y(q_1) \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
I_x(q_2) & I_y(q_2) \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
\vdots & \vdots \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
I_x(q_n) & I_y(q_n) \end \quad\quad\quad v = \begin V_x\\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
V_y \end \quad\quad\quad b = \begin -I_t(q_1) \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
-I_t(q_2) \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
\vdots \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
-I_t(q_n) \end This system has more equations than unknowns and thus it is usually over-determined. The Lucas–Kanade method obtains a compromise solution by the
least squares The method of least squares is a standard approach in regression analysis to approximate the solution of overdetermined systems (sets of equations in which there are more equations than unknowns) by minimizing the sum of the squares of the res ...
principle. Namely, it solves the 2 \times 2 system :A^T A v=A^T b or :\mathrm=(A^T A)^A^T b where A^T is the
transpose In linear algebra, the transpose of a matrix is an operator which flips a matrix over its diagonal; that is, it switches the row and column indices of the matrix by producing another matrix, often denoted by (among other notations). The tr ...
of matrix A. That is, it computes :\begin V_x\\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
V_y \end = \begin \sum_i I_x(q_i)^2 & \sum_i I_x(q_i)I_y(q_i) \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
\sum_i I_y(q_i)I_x(q_i) & \sum_i I_y(q_i)^2 \end^ \begin -\sum_i I_x(q_i)I_t(q_i) \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
-\sum_i I_y(q_i)I_t(q_i) \end where the central matrix in the equation is an
Inverse matrix In linear algebra, an -by- square matrix is called invertible (also nonsingular or nondegenerate), if there exists an -by- square matrix such that :\mathbf = \mathbf = \mathbf_n \ where denotes the -by- identity matrix and the multiplicati ...
. The sums are running from i=1 to n. The matrix A^T A is often called the
structure tensor In mathematics, the structure tensor, also referred to as the second-moment matrix, is a matrix derived from the gradient of a function. It describes the distribution of the gradient in a specified neighborhood around a point and makes the info ...
of the image at the point p.


Weighted window

The plain least squares solution above gives the same importance to all n pixels q_i in the window. In practice it is usually better to give more weight to the pixels that are closer to the central pixel p. For that, one uses the weighted version of the least squares equation, :A^T W A v=A^T W b or : \mathrm=(A^T W A)^A^T W b where W is an n \times n
diagonal matrix In linear algebra, a diagonal matrix is a matrix in which the entries outside the main diagonal are all zero; the term usually refers to square matrices. Elements of the main diagonal can either be zero or nonzero. An example of a 2×2 diagonal ma ...
containing the weights W_ = w_i to be assigned to the equation of pixel q_i. That is, it computes :\begin V_x\\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
V_y \end = \begin \sum_i w_i I_x(q_i)^2 & \sum_i w_i I_x(q_i)I_y(q_i) \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
\sum_i w_i I_x(q_i)I_y(q_i) & \sum_i w_i I_y(q_i)^2 \end^ \begin -\sum_i w_i I_x(q_i)I_t(q_i) \\
0pt PT, Pt, or pt may refer to: Arts and entertainment * ''P.T.'' (video game), acronym for ''Playable Teaser'', a short video game released to promote the cancelled video game ''Silent Hills'' * Porcupine Tree, a British progressive rock group ...
-\sum_i w_i I_y(q_i)I_t(q_i) \end The weight w_i is usually set to a
Gaussian function In mathematics, a Gaussian function, often simply referred to as a Gaussian, is a function of the base form f(x) = \exp (-x^2) and with parametric extension f(x) = a \exp\left( -\frac \right) for arbitrary real constants , and non-zero . It is n ...
of the distance between q_i and p.


Use conditions and techniques

In order for equation A^T A v=A^T b to be solvable, A^T A should be invertible, or A^T A's eigenvalues satisfy \lambda_1 \ge \lambda_2 > 0. To avoid noise issue, usually \lambda_2 is required to not be too small. Also, if \lambda_1/\lambda_2 is too large, this means that the point p is on an edge, and this method suffers from the
aperture problem Motion perception is the process of inferring the speed and direction of elements in a scene based on visual, vestibular and proprioceptive inputs. Although this process appears straightforward to most observers, it has proven to be a difficult pr ...
. So for this method to work properly, the condition is that \lambda_1 and \lambda_2 are large enough and have similar magnitude. This condition is also the one for
Corner detection Corner detection is an approach used within computer vision systems to extract certain kinds of features and infer the contents of an image. Corner detection is frequently used in motion detection, image registration, video tracking, image mosai ...
. This observation shows that one can easily tell which pixel is suitable for the Lucas–Kanade method to work on by inspecting a single image. One main assumption for this method is that the motion is small (less than 1 pixel between two images for example). If the motion is large and violates this assumption, one technique is to reduce the resolution of images first and then apply the Lucas-Kanade method.J. Y. Bouguet, (2001)
. Pyramidal implementation of the affine lucas kanade feature tracker description of the algorithm. Intel Corporation, 5.
'
In order to achieve motion tracking with this method, the flow vector can be iteratively applied and recalculated, until some threshold near zero is reached, at which point it can be assumed that the image windows are very close in similarity. By doing this to each successive tracking window, the point can be tracked throughout several images in a sequence, until it is either obscured or goes out of frame.


Improvements and extensions

The least-squares approach implicitly assumes that the errors in the image data have a Gaussian distribution with zero mean. If one expects the window to contain a certain percentage of "
outlier In statistics, an outlier is a data point that differs significantly from other observations. An outlier may be due to a variability in the measurement, an indication of novel data, or it may be the result of experimental error; the latter are ...
s" (grossly wrong data values, that do not follow the "ordinary" Gaussian error distribution), one may use statistical analysis to detect them, and reduce their weight accordingly. The Lucas–Kanade method per se can be used only when the image flow vector V_x,V_y between the two frames is small enough for the differential equation of the optical flow to hold, which is often less than the pixel spacing. When the flow vector may exceed this limit, such as in stereo matching or warped document registration, the Lucas–Kanade method may still be used to refine some coarse estimate of the same, obtained by other means; for example, by
extrapolating In mathematics, extrapolation is a type of estimation, beyond the original observation range, of the value of a variable on the basis of its relationship with another variable. It is similar to interpolation, which produces estimates between know ...
the flow vectors computed for previous frames, or by running the Lucas-Kanade algorithm on reduced-scale versions of the images. Indeed, the latter method is the basis of the popular Kanade-Lucas-Tomasi (KLT) feature matching algorithm. A similar technique can be used to compute differential
affine Affine may describe any of various topics concerned with connections or affinities. It may refer to: * Affine, a relative by marriage in law and anthropology * Affine cipher, a special case of the more general substitution cipher * Affine comb ...
deformations of the image contents.


See also

*
Optical flow Optical flow or optic flow is the pattern of apparent motion of objects, surfaces, and edges in a visual scene caused by the relative motion between an observer and a scene. Optical flow can also be defined as the distribution of apparent veloci ...
*
Horn–Schunck method The Horn–Schunck method of estimating optical flow is a global method which introduces a global constraint of ''smoothness'' to solve the ''aperture problem'' (see Optical Flow for further description). Mathematical details The Horn-Schunck alg ...
* Shi–Tomasi corner detection algorithm *
Kanade–Lucas–Tomasi feature tracker In computer vision, the Kanade–Lucas–Tomasi (KLT) feature tracker is an approach to feature extraction. It is proposed mainly for the purpose of dealing with the problem that traditional image registration techniques are generally costly. KLT ma ...


References


External links


The image stabilizer plugin for ImageJ
based on the Lucas–Kanade method
Mathworks Lucas-Kanade
Matlab implementation of inverse and normal affine Lucas-Kanade
FolkiGPU:
GPU implementation of an iterative Lucas-Kanade based optical flow
KLT
An Implementation of the Kanade–Lucas–Tomasi Feature Tracker


C example
using the Lucas-Kanade optical flow algorithm
C++ example
using the Lucas-Kanade optical flow algorithm
Python example
using the Lucas-Kanade optical flow algorithm
Python example
using the Lucas-Kanade tracker for homography matching

of Lucas-Kanade method to show optical flow field

of Lucas-Kanade method to show velocity vector of objects {{DEFAULTSORT:Lucas-Kanade method Motion in computer vision Japanese inventions