Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Simple algorithm for tracking objects between frames

Hey all,

I'm using contour finding (along with background subtraction) to pick out objects from a scene -- however, I'd like to also be able to track objects from frame to frame.

Given two frames, I'd like to be able to map objects from the new frame to objects in the old frame and keep track of the objects externally. Right now my algorithm:

  • Creates a list of all found objects in the current frame
  • For each object found in the current frame:
    • Find the object in the previous frame that is the closest to its current position
    • Check if the object is within a reasonable distance (say, 100 pixels)
    • If the object is close enough, call it the same object and update the previous object's position.
    • If the object is too far, create a new object (the object must have entered the scene)

This very simplistic algorithm gives me okay results, but I was wondering if there was a better method available in the OpenCV library. I'm not familiar with standard computer vision techniques, but I imagine there must be a better way! Any suggestions?