header image

Go back

These are instructions on how to prepare the data for Crosswalk Incident Detection or Bicyclist Detection software.

MFC Background Subtraction

This software performs background subtraction on an input video. It was developed by Andrews Sobral (source).
To run, double click on mfc_bgslibrary_x86_v1.4.1\mfc_bgslibrary.exe
You can choose different background subtraction method in (1). The full list of methods can be found on this link (with citations).
Put the path to the input video in (2).
Make sure "Save input frames" and "Save foreground masks" are selected.
Click on Start, wait until it finishes running, then click on Save Results.
The masks and video frames will be stored in mfc_bgslibrary_x86_v1.4.1\output\foreground and mfc_bgslibrary_x86_v1.4.1\outputs\input, respectively.

 

MFC Rename Tool

This utility is used to rename output files from MFC Background Subtraction to be used with Tracking Tool.

To run, copy folder "foreground" and "input" from mfc_bgslibrary_x86_v1.4.1\output\ to mfc_rename\data\ and run mfc_rename.exe.

The output will be in mfc_rename\data\foreground_renamed and mfc_rename\data\input_renamed.

Tracking Tool

This software is the compiled binaries of the Urban Tracker project (link). It tracks moving objects in the video and output a text file containing the motion trajectories of all objects in the video.

First, we need to prepare the data using MFC Background Subtraction and MFC Rename Tool as described above.

Then, create a new folder in TrackingApp\ directory, give it a name, and populated it with foreground_renamed, input_renamed, and the configuration files (algo.cfg, filepath.cfg, main.cfg, and tracking.sqlite). (Please see TrackingApp\TestVideo folder for example).

Edit main.cfg
seek-frame: the first frame to perform tracking, usually set to 0.
Video-end-frame: last frame to perform tracking, usually the last frame in the video, find this frame number in folder input_renamed

Edit filepath.cfg
framelist-filename: path to input_renamed
bgs-filepath: path to foreground_renamed

Then, Open up cmd.exe, and run TrackingApp using the following command:
TrackingApp.exe folder_name/main.cfg

When finished running, TrackingApp will produce file tracking_output.txt.