Open CV tracking the same blob over multiple frames

I am trying to track multiple people with the kinect over time, so I want to know and record when someone has left, entered, and where they move. In other words I need to keep track of the blobs over multiple frames.

The problem is that the blob array blobs[i], is refreshing every frame, and therefore what used to be blob 0 (blobs[0]) might now be blobs[1]. I can’t seem to figure out in what order its detecting and inserting the blobs into the array every frame. Currently my application is drawing lines with the blobs[i].boundingRect information, but for example the line for blobs[0] is formed from multiple objects since in a new frame blob[0] might not be the same object in the scene.


check out ofxCV’s (not ofxOpenCv) example tracker (

Unfortunately the ofxCv code is much harder for me to understand than the openCv. how to use the ofCv functions. Is there an explanation you know of anywhere?

it’s well worth your time for tracking objects over multiple frames; try to study the readme and work your way through the contour examples. Otherwise you’ll need to make a tracker from scratch, and that will probably take more time.

try this:

it’s bit messy. the read labels are blobs that disappeared but are still remembered, they might come back alive.
the black labels are alive.

1 Like