DIY 2D Motion Tracker (Webcam)

This project started with a desire to create a program which can automatically capture 2d motion data paths of certain elements (markers) of a video clip or webcam capture. Bright points of light (leds) are used as the tracking markers. These markers are physically attached to the item which is to be tracked. Over a period of time (frames) the markers viewed in the video feed have their XY coordinates recorded and their motion paths (keyframes) are computed (or output as a plain text file). During post production virtual objects can be applied to the motion path and seamlessly integrated within the scene e.g. an actor moves a wand (with attached led) around the scene. Special effect 'sparkles' can be added to the scene and track the motion path of the wand perfectly.

Programmed in Just Basic (JB)

This frames of video were captured with VFWGrab. Every 10th of a second a JPG was captured and stored in a folder. After the video was finished the JPG's were converted in 24 bit BMPs (JB native file format). The image files were analysed using binary operations and the bright spot on the paper I'm holding was found by searching for only the red hex value in the BMP data chunk (white contains full RGB values B255 G255 R255). If the red component was above a certain brightness value (threshold) we had found the brightest portion of the image.

This bright area was tracked throughout each frame of the movie and the XY data values were saved as keyframes. These keyframes would be used as markers to align overlaid graphics or effects (seen banner above).

Just Basic 1.01 (Free - easy to use programming language)

http://www.justbasic.com/download.html

Naughter Webcam VFWGrab 1.07

http://www.naughter.com/vfwgrab.htm

2D Tracker Tests (Just Basic)

Source (gif animation)

Virtual writing (gif animation)

BMP Sprite attached to path. (gif animation)

2D Two Point Tracker (Not individually tracked)

(gif animation)

2D Tracker Tests (Animated)

Walk (gif animation)

Webcam - Realtime 2D Tracker Tests (4-6fps) [Visual Basic]

To test the code I manually placed these images into the image folder. The code waits for new images to appear and automatically tracks the brightest area. The green circles highlights the area being tracked.

Good track

Track various shapes

Dots show extreme bounds

Oops - What's going on here!

Webcam - Realtime Effects (4-6fps) [Visual Basic]

Bright areas colorised with big red pixels to

create a LCD type image.