Tracker How To
Tracker How To
By David Chandler
I use a number of free, open source programs to do video analysis.
1. Avidemux, to exerpt the video clip, read the video properties, and save the clip as a sequence of
jpg images. Avidemux will also allow a large number of filters for other kinds of preprocessing, such as brightening, resizing, changing the frame rate (for slow motion effects,
etc.), etc.
2. Irfanview: an image processing program for doing transformations on still images. Irfanview
is particularly good for my purposes because it has a batch mode which works well on the
image sequences produced by Avidemux.
3. Tracker, which is part of the Open Source Physics project, is currently my favorite frame
tracking software. Not only does it work well, but Doug Brown, its author, is very responsive
with bug fixes. It works either with mov files (i.e. Mac Quicktime) or jpg sequences. I use the
jpg sequences because converting avi files to mov files can be problematic.
Using Avidemux to create a sequence of jpg images
Get and install Avidemux from http://avidemux.sourceforge.net/ . Open Avidemux, then drag and drop
a video into it. Check the frame rate and other video information with the round, blue Info button. If
you want to select a clip from a longer video, advance the video to the start point and use the A
option at the bottom. Go to the ending point and use the B option. A and B select the active video
segment. Now go to File-Save-Save Selection as JPEG images. Be sure to save them to a clean
folder. This will save the individual frames as jpg files with a single file name followed by sequential
frame numbers.
Using Irfanview
Download Irfanview from http://www.irfanview.com/. Get both the program and the plugins. If you
then need to do any processing of the image sequence created by Avidemux, such as cropping and/or
resizing, open the first image of the sequence in Irfanview. Then type B to enter batch mode. This
will automatically open the folder containing the image you started with. Select all the files you want
to alter and add them to the working list, which will be shown in the area at the bottom right. Use the
sort option to make sure the images are sorted into ascending order by name. (Since the names are
identical except for the sequence number, this sorts them into the correct sequence.)
Then on the left, select Batch Conversion and Rename, select jpg as the Output Format and check the
box for using the Advanced functions. Click the Advanced button and select the various filters you
want to apply, such as crop, resize, etc. (To get the parameters for crop and resize you might want to
play with an individual frame first before entering Batch mode.) After saving and exiting the Advanced
settings, set the naming pattern and use hash marks for digits. (Be careful about using -s in the file
names. Irfanview is a little restrictive on file names.) Use the Options button to choose the starting
number, etc. for the output sequence. Select the output directory and start the batch processing. Be
sure to use non-destructive processing, especially the first few times when you're learning the ropes.
By the way, to reassemble a processed sequence of jpgs as a movie, drag and drop only the first of the
numbered frame sequence back into Avidemux. It will import the whole sequence. From there, set the
output video parameters on the left and save as a video.
Using Tracker Itself
Get Tracker from http://www.cabrillo.edu/~dbrown/tracker/ . I recommend downloading the exe
version, assuming you are using a Windows PC. Follow the installation instructions carefully.
Now start tracker.
It has a main window for the video, and defaults to a plot view in the top right and a table view in the
bottom right. The little icons at the top left of the small windows allow you to change those displays if
you want something else.
To start, drag and drop the first image from an image sequence into the main window.
Note that I have taped a meter stick on the vertical surface near my hand at the right. You need
something in the video you can use to calibrate the measurement. I could have used the spacing of the
wall boards, the height of the window, or anything else of known size. The calibration reference points
should be at about the same distance from the camera as the action of interest.
Use the tool in the toolbar with the blue 10 and double headed arrow to mark the calibration length.
Clicking it will cause the dimension marker to pop into the frame. Drag the ends of the arrows to the
points you want to use and type in the known distance at the midpoint. I recommend zooming in with
the magnifying glass to assure accurate placement. (To regain the use of the cursor once you have
zoomed, cycle the magnifying glass to its blank state with neither + nor marks.) Once the calibration
is finished, you can drag the blue double arrow anywhere you want and measure other things in the
image. The calibration won't change unless you retype the distance information.
Next, set the video parameters with the icon that looks like a clip of film at the bottom right corner of
the main window. (If you hover over it, it says Clip settings.) For some reason it defaults to 10 fps.
Normally this would be set to 30 fps, but my particular camera shoots at 60 fps (HD). You should have
checked the frame rate of the source video in Avidemux before decomposing it into jpg images. If you
want your points to be at 0.1 second intervals, make the step size 3/30 or 6/60. You typically don't
want the step size too small or the signal to noise ratio degenerates.
A Track Control box will pop up. Click on it for a drop-down menu. Make sure Visible and Autostep
are checked. I typically choose a position footprint that is a small spot. For some special purposes a
vertical or horizontal line is what you want. You can change this on the fly later on, so just go with a
spot for now.
Now add measurement points to the frames by hovering the arrow cursor over the point and doing a
Ctrl-Click. If you have checked Autostep above, it should automatically step to the next frame when a
mark is added. Again, you can zoom in to get more precise placement. One nice thing about the
zoomed placement is that the precision is better than a pixel. You get access to the zoomed pixel scale.
This is useful if, as is usually the case, edges are not sharp. You can interpret the relative gray of the
edge pixels to get a consistent positioning.
Once you have added your positions, click the little red diamond shaped tool (labeled on hover: show
or hide positions) to display the points, and cycle the set trail length tool (an icon with one or more
little blue dots in an arch) to show all, some, or none of the position marks. One method is to lay out
the positions crudely then zoom in and move the placed marks with greater precision.
By default the graph is at the top right and by default it shows x vs t. You can change the dependent
variable by clicking on it directly and selecting other display quantities. For instance the illustration
shows y vs t. It can also display v(x) or v(y) vs t and many other options.
Now let's do some analysis. Right click on the small graph at the top right and select Analyze.
You will get a second window with the imported data table and graph. (This is actually a second
program that is accessible separately from Tracker if you want to do data analysis with existing data
tables.) By the way, if you go back and forth from Tracker to Analysis repeatedly with different
dependent variables, the number of data columns will accumulate. You can control which ones are
used for analysis by dragging the columns to the yellow and green positions as shown here for t and y.
You can control which data sets are displayed with the check boxes at the top of the table.
Now let's fit a curve to the data. At the top left check Fit, then at the bottom left check Autofit, and
where it says Fit Name, select the appropriate curve. Notice that the function is given and the
parameters for the function are given at the right. This particular curve is not appropriate for the data
set as a whole, so you can then choose the range of data you want to fit.
Sweep over the data points of interest with the mouse and a dotted rectangle will appear. The data
points within the rectangle will be marked yellow and only these will be used to calculate the fit. The
function and parameters are now a fair representation of the curve.
There are a lot more features, such as modeling and simulations, representation of vector quantities,
etc. I haven't explored them all.