This repository contains the code for MultiTracker : Multiple Object Tracking using OpenCV (C++/Python) blog.
- Download the code and extract the downloaded file, if required.
- Create a
build
folder:mkdir build && cd build
. - System specific instructions:
- For Windows Operating System: Tell CMake to configure and generate project files in Visual Studio 14 x64 format.
Use
..
to look for CMakeLists.txt file in the parent folder of build directory. It will generate project files in Visual Studio 14’s format.cmake -G "Visual Studio 14 2015 Win64" ..
- For Linux/MacOS:
Tell CMake to configure and generate project files.
..
denotes that CMake should look for CMakeLists.txt file in the parent folder of build directory. For Linux/MacOS cmake detects and uses the C++ toolchain installed on your system It will most likely be gcc toolchain.cmake ..
- For Windows Operating System: Tell CMake to configure and generate project files in Visual Studio 14 x64 format.
Use
- Now tell CMake to build project in Release mode:
cmake --build . --config Release
- When the build is completed, executables will be generated in
build\Release
folder orbuild
folder itself. - Now go back to project directory (parent directory of build) and run the compiled script:
./build/multiTracker
- Download the code and extract the downloaded file, if required.
- Use
python multiTracker.py
to run the code.
The scripts use CSRT
as the default tracking algorithm. To use any other algorithm, change trackerType
variable to the tracker of your choice.
Note that only these tracking algorithms are available in the scripts: BOOSTING
, MIL
, KCF
, TLD
, MEDIANFLOW
, GOTURN
, MOSSE
, CSRT
.
To change the trackerType
variable in C++, go to line number 58 and change the tracker to "BOOSTING"
, for example.
To do the same for Python code, edit trackerType
variable in line number 46.
For instructions regarding how to use GOTURN tracker, please refer to the blog on GOTURN: Deep Learning based Object Tracking and the corresponding GitHub repository.