Kanade-Lucas-Tomasi (KLT) Feature Tracker
Kanade-Lucas-Tomasi (KLT) Feature Tracker
Kanade-Lucas-Tomasi (KLT) Feature Tracker
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Kanade</strong>-<strong>Lucas</strong><br />
<strong>Kanade</strong> <strong>Lucas</strong>-<strong>Tomasi</strong> <strong>Tomasi</strong> (<strong>KLT</strong>)<br />
<strong>Feature</strong> <strong>Tracker</strong><br />
Computer Vision Lab.<br />
Jae Kyu Suhr<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Introduction<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Motivation<br />
Image sequence<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Motivation<br />
<strong>Feature</strong> point detection<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Motivation<br />
<strong>Feature</strong> point tracking<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Motivation<br />
Tracking result<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
3D Reconstruction results<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Problem Statement<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Problem Statement<br />
• I, J : 1 st and 2 nd grayscaled images<br />
• I(x,y) : gray value of I at [x y] T<br />
• Let u=[u x u y ] T be a point on the 1 st image I<br />
• The goal is to find v on J, where I(u) and J(v) are<br />
similar. (v= u+d = [u x +d x u y +d y ] T )<br />
• d=[d x d y ] T is the image velocity at u<br />
or the optical flow at u.<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Problem Statement<br />
• Definition of the residual function ε(d).<br />
(u x , u y )<br />
w x<br />
w y<br />
I J<br />
• ωx and ωy integration window size parameter<br />
integration window size (2ωx +1)×(2ωy +1).<br />
∑( - ) 2<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Pyramid Implementation<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Why pyramid representation?<br />
• Standard <strong>KLT</strong> algorithm can deal with small pixel displacement.<br />
• Solution for this is a pyramidal implementation.<br />
• Let I 0 =I be the 0 th level image<br />
• The pyramid representation is built recursively.<br />
I 0 → I 1 → I 2 → I 3 → I Lm …(Lm: 2~4)<br />
• I L-1 : the image at level L-1<br />
I L : the image at level L<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Pyramidal feature tracking<br />
• A given point u in I, find its corresponding location v=u+d.<br />
• Corresponding point of u(u 0 ) on the pyramidal image I L is u L<br />
• Simple overall pyramid tracking algorithm<br />
d Lm is computed at the pyramid level L m<br />
d Lm-1 is computed<br />
with an initial guess of d Lm at L m-1<br />
This continues up to the level 0<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Pyramidal feature tracking<br />
• Let gL =[gL x gLy ]T be an initial guess at level L<br />
( gL is available from level Lm to level L+1 )<br />
• Residual pixel displacement vector d L =[d L x dL y ]T<br />
that minimizes the new image matching error function ε L<br />
• Window size (2ω x +1)×(2ω y +1) is constant for all pyramid<br />
• gL is used to pre-translate the image patch in 2nd image J<br />
→ dL is small and therefore easy to compute using <strong>KLT</strong> algorithm<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Pyramidal feature tracking<br />
• Assume that d L is computed, new initial guess g L-1 at level L-1<br />
• Initial guess for the deepest level L m<br />
• The final optical flow solution d<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Standard <strong>KLT</strong> algorithm<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Standard <strong>KLT</strong> optical flow computation<br />
• Goal is to find dL that minimizes the matching function εL .<br />
Same operation is performed for all levels L, drop the superscript L<br />
and define the new images A and B<br />
• Let us change the displacement vector and the point vector<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Standard <strong>KLT</strong> optical flow computation<br />
• Goal is to find that minimizes the matching function<br />
• To find the optimum<br />
• Let us substitute by its 1 st order Taylor expansion<br />
about the point<br />
frame difference Image gradient<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Standard <strong>KLT</strong> optical flow computation<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Standard <strong>KLT</strong> optical flow computation<br />
( G must be invertible).<br />
Standard LK is valid only the pixel displacement is small.<br />
(Because of the first order Taylor approximation)<br />
Therefore, iterative version of LK is necessary.<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Iterative <strong>KLT</strong> algorithm<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Iterative <strong>KLT</strong> optical flow computation<br />
• k : iteration index<br />
•<br />
: initial guess from the previous iteration 1,2,…,k-1<br />
• B k : new translated image according to<br />
• The goal is to compute that minimize<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Iterative <strong>KLT</strong> optical flow computation<br />
• One step LK optical flow computation is<br />
• I x, I y are computed only once at the beginning of the iteration.<br />
• G (2×2matrix) remains constant throughout the iteration loop.<br />
• Only δI k needs to be recomputed at each iteration<br />
• Once is computed, a new pixel displacement guess<br />
• The iteration goes on until is smaller than a threshold<br />
or reached at the maximum number of iteration.<br />
(5 are enough to reach convergence)<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Iterative <strong>KLT</strong> optical flow computation<br />
• At 1 st iteration, the initial guess<br />
• Assuming that K iterations are necessary to reach convergence,<br />
the final solution for the optical flow vector<br />
• This overall procedure is repeated at all levels L-1, L-2, … , 0<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
<strong>Feature</strong> selection<br />
• Goal is to find the location of v on J corresponding to u on I.<br />
How to detect u on I<br />
• Find the point u whose G matrix is non-singular<br />
The minimum eigenvalue of G must larger than a threshold.<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
<strong>Feature</strong> selection<br />
1. Compute the G matrix and its minimum eigenvalue λ m at every pixel<br />
in the image I.<br />
2. Call λ max the maximum value of λ m over the whole image.<br />
3. Retain the image pixels that have a λ m value larger than a threshold.<br />
4. Retain the local maximum pixels (a pixel is kept if its λ m value is<br />
larger than that of any other pixel in its 3×3 neighborhood).<br />
5. Keep the subset of those pixels so that the minimum distance<br />
between any pair of pixels is larger than a given threshold distance.<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
<strong>Feature</strong> selection<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
<strong>Feature</strong> selection<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
<strong>Feature</strong> selection<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
<strong>Feature</strong> selection<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
<strong>Feature</strong> selection<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Declaring a feature “Lost Lost”<br />
• A feature point falls outside of the image.<br />
• An image patch around the tracked point varies too much<br />
between image I and image J.<br />
(A cost function (SSD) is larger than a threshold).<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Flow chart<br />
Input 1 st image<br />
Select feature points<br />
Save feature points<br />
Input 2 nd image<br />
Track feature points<br />
Delete lost feature points<br />
Save tracked points<br />
Replace 1 st image with 2 nd image<br />
Replace 2 st image with next image<br />
Select feature points<br />
to replace lost feature points<br />
Save feature points<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
References<br />
• Bruce D. <strong>Lucas</strong> and Takeo <strong>Kanade</strong>. “An Iterative Image Registration<br />
Technique with an Application to Stereo Vision”. IJCAI, pages 674-679,<br />
1981.<br />
• J. Shi and C. <strong>Tomasi</strong>, "Good <strong>Feature</strong>s to Track," CVPR'94<br />
• Jean-Yves Bouguet, “Pyramidal Implementation of the <strong>Lucas</strong> <strong>Kanade</strong><br />
<strong>Feature</strong> <strong>Tracker</strong> Description of the algorithm”, Intel Corporation<br />
Microprocessor Research Labs.<br />
• http://www.ces.clemson.edu/~stb/klt/ C++ code<br />
<strong>KLT</strong>: An Implementation of the <strong>Kanade</strong>-<strong>Lucas</strong>-<strong>Tomasi</strong> <strong>Feature</strong> <strong>Tracker</strong><br />
• OpenCV: CalcOpticalFlowLK, CalcOpticalFlowPyrLK<br />
• http://vision.ucla.edu//MASKS/labs.html Matlab code<br />
An Invitation to 3D Vision<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.
Thank you<br />
Q & A<br />
Computer Vision (EEE6503) Fall 2009, Yonsei Univ.