first of all, I use the environment is vs2015+opencv3.2, in different circumstances of the preparation method, please.
First, the network of TLD has two versions, one is Zdenek Kalal own use Matlab+vs mixed programming, the other is arthurv using C + + and OPENCV implementation.
1.1, I am using the arthurv version of the Tracking-learning-detection
Connection: Https://github.com/alantrrs/OpenTLD
1.2, download the C + + code as shown below
which
Datasets is some video data;
Doc is the flowchart of the program to explain;
Include is a header file;
SRC is the source file;
PARAMETERS.YML is a parameter file;
The Readme is a description of the program's operation.
Second, we only need to use datasets, include, SRC, parameters.yml;
The following describes how to create a project under VS2015;
2.1, create an empty solution (no precompiled console program)
2.2. First put the file copy in include into the SRC folder, and then put SRC, datasets, parameters.yml into the solution Engineering directory, as follows:
2.3, compile the project, this time will be out of error, the following is the solution:
A First, the header file contains all the errors from include<tld.h> to include "TLD.h"; Other header files contain and so on; Explain:<> references are found in the entire file directory, including the system environment variable library, and "" Look for it in the current file directory.
b About including header files in TLD.h #include <opencv2/legacy/legacy.hpp> issues Because the original author was compiled under the opencv2.4 version, because various versions of OPENCV3 have changed a lot in relation to the OPENCV2 version, the OPENTLD tracking algorithm relies on some functions that have disappeared in Opencv3, and the most important point is that the Opencv3.2 has not including LEGACY.HPP library, so we need to add PatchGenerator.h and PatchGenerator.cpp two files, and in the corresponding place include header file (corresponding delete legacy.hpp), in order to do not missing files.
Two file reference address: http://blog.csdn.net/j10527/article/details/51305087
C LKTracker.cpp: You need to add the following lines to prevent the call from not having a defined function:
#include "vector"
#include "iostream"
using namespace Std;
D In TLD.h, because arrays in C + + cannot be variables, you need to make the following modifications:
Change the const int c = Dbb.size () to:
const int c = 100; is defined as a constant
E. Corresponding, in the TLD::CLUSTERBB function, VS does not support dynamic array allocation. The dynamic array needs to be changed to pointers and dynamically allocated memory, and the memory needs to be freed at the end.
F Round, ceil, and floor may have errors because the parameters passed in round and ceil must be double or float, so change the data in these three functions to float, in which case the integer is followed by a decimal point, such as 2, will be changed to 2.0.
int stepx = Ceil (double (bb.width-2.0 * margin_h)/max_pts));
int stepy = Ceil (double (bb.height-2.0 * margin_v)/max_pts));
G. Open Run_tld.cpp will be one of the
if (strcmp (Argv[i], "-TL") ==0) {
TL = true;
}
To
if (strcmp (Argv[i], "-NO_TL") ==0) {
TL = FALSE;
}
For the following figure this modification, I have tried, but there will be the following problems: So Tl=false has not changed, specifically why there is a problem I have not identified.
H Finally, because this project is inside is first to generate an executable file in Cmd to execute, and need to use the cmd command in advance call PARAMETERS.YML in the initialization parameters. This is not convenient for us to debug; so we want to modify the parameter parsing function at the beginning of the program:
2.4 Release complete, in the generated folder directly open the Exe file, the perfect operation (camera only, test video not called)