KCF tracking
Use a kernelized correlation filter to locate a learned appearance in a local search region.
The previous position is a starting estimate, not the new target location.
Learn a filter from shifted versions of the target patch.
The illustrative response map peaks near the new position. Ambiguous or occluded targets can produce weak or competing peaks.
Move to the response peak and update appearance.
Move to the response peak and update appearance.
Illustrative example. The stages explain the method; they are not a live OpenCV execution.
Try it on an image
Experiment at pixel level
Track an input rectangle into the second image with KCF.
The engine loads on your first run. Your images stay in this browser.
Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.
Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Select a pixel
Select a pixel
When to use it
Follow a single initialized object with relatively low CPU cost.
How it works
- 01Learn a filter from shifted versions of the target patch.
- 02Evaluate the response in the next frame.
- 03Move to the response peak and update appearance.
appearance correlation → response peak → new box
What to tune
Descriptor, kernel and learning settings control the appearance model. Check the update result before trusting the box.
Where it breaks down
Fast local tracking does not guarantee recovery after occlusion or large deformation. Re-detection is a separate task.
TypeScript API
Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.
All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.
Related methods
Lucas-Kanade optical flow
Follow selected points by finding the small displacement that best aligns each local patch.
Farneback dense optical flow
Estimate a displacement vector at every pixel using local polynomial approximations.
DIS dense optical flow
Combine fast patch alignment with spatial propagation and dense refinement.
Dual TV-L1 optical flow
Estimate flow with a robust data term and a total-variation smoothness penalty.