Tuesday, 25 March 2014

Installing OpenTLD on Ubuntu 13.04

Getting OpenTLD working on Ubuntu 13.04

- And so I see, and that is good!

Introducing OpenTLD

TLD is an algorithm started by Dr. Zdenek Kalal and made it open source under the name OpenTLD. I found this work already a few years ago, back then just got it to run on Windows. But besides that did not had a real application to apply it to. Now working on my robot and want to make it recognize things good! If you just want to see it work (fast and easy) try the windows version or better yet, the Android (see below).


You should have a look at the installation page first before continuing. On the website there is an alternative for using MatLab called Octave. In Ubuntu 13.04 the version is 3.6, but we need 3.8. So here is a quick list of what you need before getting started:
  • Ubuntu 13.04 installed
  • Download/Install OpenCV
  • Install Python development packages
  • Install build essentials
  • Download the OpenTLD source
  • Octave 3.8 source, download, ./configure, make, sudo make install 
You can compile Octave with the make -j 4(=number of cores) check here for more tips
But first a few package: sudo apt-get install python2.7-dev python-gst0.10-dev libeigen3-dev libwebcam0-dev libgstreamer0.10-dev libgstreamer-plugins-good0.10-dev libv4l-dev python-gtk2-dev libgtk2.0-dev gnuplot libjasper-dev bison++ python-pycurl libcurl-dev

Also Octave needs a few packages that come from here like: general, control, signal, image, miscellaneous, io, statistics, image-acquisition
You can download the packages and install like the example on the site. But if you enabled the cURL library with compiling Octave you can use that package manager.
octave -q
 pkg install -forge [package name]

OpenTLD Modifications

For the compile.m file to run correctly you need to adjust few things. I am not an Octave expert so perhaps these things changed, I had to in order to make it work.

In the compile.m script go to the if isunix part, for anyone with some python or other programming knowledge, it helps. The script looks for OpenCV libraries version 2.2, we are using 2.4. So change that line. The next line we change is in the i loop. Make it:
lib = [lib ' -o ' libpath files(i).name]; Where the -o is new. This is required because the i loop creates a list of files, but without the -o argument this would fail (I guess capital -O did mean all). Then a few lines down change all the argument -O (which is unknown) with -o.
Make sure the cv.h is in the general library, will make the compile part work correctly. I still was getting a problem with libraries; cv.h (simple gcc include lib should fix this, but I did it different) By just putting the full location path for "cv.h" (and highgui.h) in lk.cpp from the mex directory. Final problem here was a permission, so sudo compile.m.And Presto

Then we move on to run_TLD.m
If you run into the error about videoinput is an undeclared variable, means opencv did not compile correctly with octave. Do not search the internet for "how to compile opencv with octave" because it only works on older versions of openCV.

OpenTLD derivatives

  • Detecting multiple objects from here or a C++ implementation motld.
  • Python version here, but this was abandon...sadly

The Result

For the moment I have not yet anything to show. I am working on a way to combine the Muliple Object and the Georg N. More on this later...

1 comment: