Lucas-Kanade in A Nutshell: 1 Motivation
Lucas-Kanade in A Nutshell: 1 Motivation
Lucas-Kanade in A Nutshell: 1 Motivation
1 Motivation
– The two images are separated by a small time increment ∆t, in such a
way that objects have not displaced significantly (that is, the algorithm
works best with slow moving objects).
The algorithm does not use color information in an explicit way. It does not
scan the second image looking for a match for a given pixel. It works by
trying to guess in which direction an object has moved so that local changes
in intensity can be explained.
∗
Freie Universität Berlin, Dept. of Computer Science, Arnimallee 7, 14195 Berlin,
Germany
1
2 Technique
Assume that we watch a scene through a square hole. The intensity a visible
through the hole is variable.
mask
a - increasing brightness
?
increasing brightness
In the next frame the intensity of the pixel has increased to b. It would be
sensible to assume that a displacement of the underlying object to the left
and up has occurred so that the new intensity b is now visible under the
square hole.
v
6
movement u
b
mask
If we know that the increase in brightness per pixel at pixel (x, y) is Ix (x, y)
is the x-direction, and the increase in brightness per pixel in the y direction
is Iy (x, y), we have a total increase in brightness, after a movement by u
pixels in the x direction and v pixels in the y direction of:
Ix (x, y) · u + Iy (x, y) · v
This matches the local difference in intensity (b − a) which we call It (x, y),
so that
Ix (x, y) · u + Iy (x, y) · v = −It (x, y)
The negative sign is necessary because for positive Ix , Iy , and It we have a
movement to the left and down (think about this for a minute).
2
3 Neighborhoods
Of course, a simple pixel does not usually contain enough ”structure” useful
for matching with another pixel. It is better to use a neighborhood of pixels,
for example the 3 × 3 neighborhood around the pixel (x, y). In that case we
set 9 linear equations:
The above equation cannot be solved exactly (in the general case). The Least
Squares solution is found by multiplying the equation by S T
!
T u →
S S = ST t
v
4 Invertibility
3
neighborhood). Even if the matrix is invertible it can be ill conditioned, if
its elements are very small and close to zero.
One way of testing how good the inverse of S T S for our purposes is, is to
look at the eigenvalues of this matrix. S T S is a symmetrical matrix, and as
such can be diagonalized and written in the form
!
T λ1 0
S S=U UT
0 λ2
Testing the size of the eigenvectors can be done by solving the characteristic
equation
det(S T S − λI) = 0
which reduces to
X X
Ix2 (x + ∆x, y + ∆y) − λ Ix (x + ∆x, y + ∆y)Iy (x + ∆x, y + ∆y)
N N
det X X =0
Ix (x + ∆x, y + ∆y) · Iy (x + ∆x, y + ∆y) Iy2 (x + ∆x, ` + ∆y) − λ
N N
This is a quadratic equation for λ, which can be readily solved. The sums
are computed over the neighborhood of pixels N .
5 Conclusions
4
We assume that all intensity changes can be explained by intensity gradients.
The method breaks down when the gradients are random (think of an image
of random points) or when the gradients are negligible (no structure, as in flat
surfaces). The Lucas-Kanade algorithm eliminates regions without structure
by looking at the invertibilily of the matrix S T S in an indirect way, that is,
through the eigenvalues of this matrix.
The result of the algorithm is a set of optical flow vectors distributed over
the image which give an estimation idea of the movement of objects in the
scene. Of course, some optical flow vectors will be erroneous.
The main advantage of the algorithm is, that for a neighborhood of fixed size,
→
the number of operations needed to compute (S T S)−1 S T t are constant,
and therefore the complexity of the algorithm is linear in the number of
pixels examined in the image. Alternative algorithms that match similar
regions using a neighborhood, and scanning the second image, have quadratic
complexity.
References:
B.D. Lucas, T. Kanade, ”An Image Registration Technique with an
Application to Stereo Vision”, in Proceedings of Image Understanding
Workshop, 1981, pp. 121-130.