Lab software

In the labs we will be using Matlab augmented with mexMTF. Matlab is a package for matrix computations and linear algebra. As images can be represented as matrices and geometry computations are linear algebra this is a convenient tool. mexMTF allows us to bring live video into Matlab, as well as provides real-time tracking (used for point correspondence in the labs).

Matlab

Matlab is available on the lab machines with cameras attached For remote logins you can also use matlab on the central server ohaton. For the machines in labs machines the console user has first priority to the CPU cycles, so be mindful if you log on remotely.

Useful Matlab links:

mexMTF

mexMTF is the Matlab interface to the MTF visual tracking library.
mexMTF commands are invoked using the MATLAB function [success, out1, out2, ...] = mexMTF('command',p1,p2,...) where p1, p2, ... are the parameters required for the command and out1, out2, ... are the outputs produced, if any. The first output success is a flag that indicates whether or not the command invocation was successful.
mexMTF has both single and multi threaded versions where the latter, called mexMTF2, is recommended as being faster and more stable. A complete example of using it can be found in ~vis/ugrad_vision_w13/src/MTF/Examples/matlab/runMTF2.m (or runMTF.m for the single threaded version).

Preliminaries: Setting your environment variables and path

Using mexMTF to capture images:

Using mexMTF to track objects:

Using MTF without Matlab:

If Matlab crashes a lot while using mexMTF or the tracking results are not needed for online processing in Matlab, MTF can also be run directly from the terminal using this command:
$ runMTF ‹pairwise_arguments›
where the pairwise_arguments are the same as passed to mexMTF with init and create_tracker commands except that both must be combined into a single command. For example, to start tracking a manually selected object on firewire camera pipeline, following command can be used:
$ runMTF pipeline v img_source f vp_fw_res 640x480 mtf_sm esm mtf_am ssd mtf_ssm 2
A pre-recorded video can be tracked using:
$ runMTF actor_id -1 img_source m db_root_path ‹path to video file› seq_name ‹video file name without extension› seq_fmt ‹video file extension› Tracking results can be saved in a text file in the same format as the ground truth by setting write_tracking_data to 1.
The output file name can also be specified using tracking_data_fname. If this is not provided, the file name will be constructed automatically from the tracker settings.
This file can be loaded in Matlab for further processing of the tracking result using:
>> tracking_res = importdata(‹result file name›)
tracking_res.data will then contain the object locations for all frames as an N x 8 array where N is the number of tracked frames.
As mentioned before, it is usually more convenient to set most of the parameters in cfg files and change only a few (or none) for each run. In that case, MTF can be run as:
$ runMTF config_dir ‹location of the folder containing the cfg file›
For instance, the default cfg files can be copied as:
$ mkdir ~/mtf_cfg
$ cp ~vis/ugrad_vision_w13/src/MTF/Config/*.cfg ~/mtf_cfg

and then MTF called to read parameters from the copied files as:
$ runMTF config_dir ~/mtf_cfg
If other command line arguments are supplied too, then config_dir must be the first one.

When something doesn't work

If you get an error message "no camera found" in coriander, or MTF will not work, one of the following can help: