Skip to content
dansmall99 edited this page May 5, 2011 · 46 revisions

Windows

for Windows7 x 32bits:

Tested on: Matlab R2010a, MS Visual Studio 2010, Windows 7 (32-bit), OpenCV2.2.

You will need some extension toolboxes for Matlab, see below.

  1. Install OpenCV2.2: compile OpenCV, set system PATH variable to link to OpenCV DLLs

  2. Setup mex compiler in Matlab: run: mex -setup, select Visual Studio 2010 compiler from the list

  3. Compilation of mex files: check paths in 'compile.m' file, run 'compile.m'

  4. run 'run_TLD.m', TLD should track a motorbike

for Windows7 x 64bits:

Matlab R2010b x 64bits

Win7 x 64

VS2010 x 64

  1. download OpenCV2.2 source (normal binary installer is 32-bit, so you will need to recompile all from source)

  2. configure CMake compiler for VS2010 64bit compiler

2.1) set opencv cmake build directory to OpenCV2.2/build64

2.2) configure & generate SLN file

2.3) open OpenCV.sln with VS2010

2.4) build entire solution

2.5) build INSTALL project (this puts include files in the appropriate places)

  1. edit compile.m in TLD for the two openCV paths for include and lib; mine look like so:

    include = ' -If:\dan\OpenCV-2.2.0\build64\include\opencv\ -If:\dan\OpenCV-2.2.0\build64\include' ;

    libpath = 'f:\dan\OpenCV-2.2.0\build64\lib';

  2. Add path to OpenCV2.2 dll's to the PATH environment variable: f:\dan\OpenCV-2.2.0\build64\bin'

  3. In TLD source, comment out the following lines in lk.cpp, fern.cpp, and bb_overlap.cpp

    #ifdef _CHAR16_T

    #define CHAR16_T

    #endif

    Otherwise, you will get an error about int being undefined which is a no-no in 2010.

  4. In Matlab, run compile.m

6.1) If you get include errors, see 2.5

  1. run run_TLD.m

7.1) If you get a 32-bit error, make sure your path points to the 64bit version of OpenCV dll's

Mac

Installation on MacOS works, but there is not a tutorial at this time.

Linux

  1. Install OpenCV

    sudo apt-get install libcv-dev (this will most probably be 2.1)

2a) Install Matlab (>= R2009b). You will need some extension toolboxes, see below.

2b) There are efforts underway to make TLD work with Octave, an open source alternative to Matlab.

You will need to install octave >=3.4 (<3.4 if you work around the tilde problem, see Common Issues). Also, install octave extension packages miscellaneous, image, statistics from http://octave.sourceforge.net/packages.php.

  1. Check paths in 'compile.m' file

  2. run 'compile.m', (either in matlab or octave). If you get errors go to OpenTLD discussion group

  3. run 'run_TLD.m', TLD should track a motorbike

(Taken from the master in bilderbuchi's fork, using the README in commit 33bef141d8d8ea87d9c0 on 15 April 2011.)

Needed Matlab extensions

Image Acquisition Toolbox, Image Processing Toolbox, Signal Processing Toolbox, Statistics Toolbox

Common Issues when Compiling/Running OpenTLD

  • The tilde character ~ is used in some of the Matlab code as a dummy variable. Older versions of Matlab (<R2009b) do not support this notation, though, so you may need to replace these characters with your own (arbitrary) variable names. See here and here.
  • An error like error LNK2019: unresolved external symbol or similar means that the linker hasn't found the libraries, which means that either the library path is wrong or that the library files haven't been built properly. Examine the contents of the 'lib' variable just before mex is called, there should be a few files detected, if it's empty you need to sort it out. Resolving the external symbols is the job of the linker which means that all the files actually compiled fine and you're almost there.

Alternatives to Matlab

There is an active group of people from the Google Group working toward an implementation using Octave instead of Matlab. Until development with Octave is stable, you will find the most recent updates of the Octave compatible code at https://github.com/bilderbuchi/OpenTLD/.

This page is based in part on conversations on the OpenTLD discussion group at: http://groups.google.com/group/opentld/

Clone this wiki locally