Skip to content

MIL tracking

Learn an online appearance classifier from bags of nearby positive and negative samples.

Try it on your image ↓

VISUAL WALKTHROUGHMotion
REFERENCE INPUTTarget moves in the next frame

The previous position is a starting estimate, not the new target location.

RESULTUpdate the target box

Choose the best-scoring patch in the next search area.

STEP 03 / 03

Choose the best-scoring patch in the next search area.

Illustrative example. The stages explain the method; they are not a live OpenCV execution.

Try it on an image

YOUR IMAGE · REAL OPENCV

Experiment at pixel level

Open full lab ↗

Track an input rectangle into the second image with MIL.

The engine loads on your first run. Your images stay in this browser.

Input448 × 320
OutputWaiting for a result

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
Hover to inspect. Click to pin a pixel.
Input
Select a pixel

Output
Select a pixel

Sample models and licenses

When to use it

Track a user-selected object when initialization is approximate and online adaptation is useful.

How it works

  1. 01Sample patches around the current target.
  2. 02Update a multiple-instance learning classifier.
  3. 03Choose the best-scoring patch in the next search area.

candidate patches → online classifier → selected location

What to tune

Sampling radii and candidate counts affect the search region and update cost.

Where it breaks down

Appearance updates can reinforce drift. Occlusion and abrupt displacement remain difficult.

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.