A C++ implementation of OpenTLD
Switch branches/tags
Nothing to show
Clone or download
#60 Compare This branch is 164 commits ahead, 4 commits behind zk00006:master.
gnebehay Merge pull request #65 from Werkov/fix-gcc6-compilation
fix ambiguous abs() calls in GCC 6
Latest commit 160a7e2 Aug 30, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
debian v1.4.0 Jul 10, 2013
res v1.4.0 Jul 10, 2013
src fix ambiguous abs() calls in GCC 6 Aug 20, 2016
.gitignore fixed eternal reuseFrameOnce-loop Nov 29, 2013
AUTHORS fix remaining bb May 8, 2014
CMakeLists.txt Use cmakes own FindOpenMP.cmake Feb 10, 2014
LICENSE Add Copyright and License Information Nov 21, 2011
OpenTLDConfig.cmake.in + opentld standalone lib + 3rdparty folder Jul 13, 2012
README.md New link to binaries Mar 27, 2014



This is a C++ implementation of OpenTLD that was originally published in MATLAB by Zdenek Kalal. OpenTLD is used for tracking objects in video streams. What makes this algorithm outstanding is that it does not make use of any training data. This implementation is based solely on open source libraries, meaning that you do not need any commercial products to compile or run it.

The easiest way to get started is to download the precompiled binaries that are available for Windows and Ubuntu 12.04.
There is also a PPA available for Ubuntu 12.04. You just have to execute these commands:

sudo add-apt-repository ppa:opentld/ppa
sudo apt-get update
sudo apt-get install opentld

If you have a webcam attached to your PC, you can simply execute opentld (on Linux) or opentld.exe (on Windows) in order to try it out. You can use the graphical configuration dialog as well, you just have to execite qopentld (on Linux) or qopentld.exe (on Windows).
For other configuration options, please see below.

A documentation of the internals as well as other possibly helpful information is contained in this master thesis.


Keyboard shortcuts

  • q quit
  • b remember current frame as background model / clear background
  • c clear model and stop tracking git
  • l toggle learning
  • a toggle alternating mode (if true, detector is switched off when tracker is available)
  • e export model to file specified in configuration parameter "modelExportFile"
  • i import model from file specified in configuration parameter "modelPath"
  • r clear model, let user reinit tracking

Command line options


opentld [option arguments] [arguments]

option arguments

  • [-a <startFrameNumber>] video starts at the frameNumber startFrameNumber
  • [-b <x,y,w,h>] Initial bounding box
  • [-d <device>] select input device: device=(IMGS|CAM|VID|STREAM)
    IMGS: capture from images
    CAM: capture from connected camera
    VID: capture from a video
    STREAM: capture from RTSP stream
  • [-e <path>] export model after run to path
  • [-f] shows foreground
  • [-i <path>] path to the images or to the video.
  • [-j <number>] show trajectory for the last number frames
  • [-h] shows help
  • [-m <path>] if specified load a model from path. An initialBoundingBox must be specified or selectManually must be true.
  • [-n <number>] Specifies the video device to use (defaults to 0). Useful to select a different camera when multiple cameras are connected.
  • [-p path] prints results into the file path
  • [-s] if set, user can select initial bounding box
  • [-t <theta>] threshold for determining positive results
  • [-z <lastFrameNumber>] video ends at the frameNumber lastFrameNumber. If lastFrameNumber is 0 or the option argument isn't specified means all frames are taken.


[CONFIG_FILE] path to config file

Config file

Look into the sample-config-file for more information.



  • OpenCV
  • CMake
  • libconfig++ (optional)
  • Qt4 (optional)



OpenTLD uses CMake to create native build environments such as make, Eclipse, Microsoft Visual Studio. If you need help look at Running CMake.

You can use cmake-gui, if you need a graphical user interface.

Use CMake to build the project. You can use "cmake-gui", if you need a graphical user interface.


  • Specify the source path (root path of the dictionary) and the binary path (where to build the program, out of source build recommended)
  • Configure
  • Select compiler
  • Adjust the options (if needed)
  • Configure
  • Generate

Command line
If you have uncompressed the source in $OPENTLD, type in a console:

mkdir ../build
cd ../build

CMake options

  • BUILD_QOPENTLD build the graphical configuration dialog (requieres Qt)
  • USE_SYSTEM_LIBS don't use the included cvblob version but the installed version (requieres cvblob)

Windows (Microsoft Visual Studio)

Navigate to the binary directory and build the solutions you want (You have to compile in RELEASE mode):

  • opentld build the project
  • INSTALL install the project

Note: vcomp.lib is necessary when you try to compile it with OpenMP support and the Express versions of MSVC. This file is included in the Windows Server SDK.

Linux (make)

Navigate with the terminal to the build directory

  • make build the project
  • make install build and install the project


  • brew install python
  • brew install gfortran
  • easy_install numpy
  • brew install cmake
  • brew install opencv
  • cmake build the project

Debian package

  • Navigate with the terminal into the root dictionary of OpenTLD (OpenTLD/)
  • Type debuild -us -uc
  • Delete the temporary files in the source tree with debuild clean