Point Tracking

My friend Samuel Joseph was trying to track a multi-jointed pendulum as part of a science-fair type project (the ASHSSS, or Alaska High School Science Symposium).  He didn't want a mechanical tracker, because that would interfere with the pendulum's motion, so a camera was the only way to go.  He also wanted to make at least several dozen runs, and capture the motion information multiple times per second, so manual analysis (e.g., click the center of the pendulum) wasn't possible.

So I wrote him a tiny little Linux program to do the following:
Here's an image of the program in action, tracking a pink Post-It (tm) note:
Pink post-it being automatically tracked by computer vision application

The program is currently only for Linux, but it should work with any webcam.  You can:
The processing this program performs is to look for a target color, which you can choose by clicking on the left part of the window, or by passing an HTML-style color like "#ff00cc" on the command line. Pixels from the webcam with that color are selected, and the center of mass of that color is determined and displayed on the left.

The color selection tolerance can be adjusted by clicking in the right part of the window: click toward the bottom for larger tolerance (more pixels selected); toward the top for lower tolerance (fewer pixels selected).

The output text file is called "points.txt", and is just 4 columns of numbers separated by tabs:
  1. Time, in seconds, since the first spot was found.
  2. X coordinate of spot, in onscreen pixels (0-640)
  3. Y coordinate of spot, in onscreen pixels (0-480)
  4. Size of spot, in pixels (0-10,000)
This file can be imported directly into MS Excel by setting the "column separator" to tabs.

The program seems pretty robust to bad matches outside your main object--here the false matches due to the Dance Dance Revolution control pad on the floor are rejected as being too far from the center of mass search rectangle:
Rejecting false matches as too far from the center of mass.

Orion Sky Lawlor, 2005/12
Back to Orion's Oeuvre.
Back to Orion's Home Page.