Computer vision marker tracking, plus mechanical fabrication, for physics experiment

100% complete

With a friend, I conducted a torsion pendulum experiment. I built the apparatus and software.

The software, TrackXY, uses a webcam and a computer vision library to track a marker on the edge of the pendulum. We used the data to estimate its period.

The software tracks, in realtime, horizontal and vertical displacement of the marker.
Logs timestamp, x and y to comma-separated value (.csv) file importable to spreadsheet.

Uses Lukas-Kanade algorithm and based on lkdemo.cpp in OpenCV, stripped down to track single point in high contrast against a uniform background. Based on the BSD licensed OpenCV, TrackXY also has BSD-style license.

It's a barebones program. I couldn't find any other ready-made program that would track an object in real-time from webcam, other than an $80 special-purpose program used in another torsion balance experiment we were replicating. I wrote TrackXY to reduce barriers to entry to science.

Planned features include versions for each platform, a GUI, comprehensive data management, and data analysis tools.


We found the behavior of the torsion pendulum to match the conventional model, when we ran the experiment in a room with still air and with nothing disturbing the pendulum.