Opentld Source code generation VS2010 Engineering and compilation process

Source: Internet
Author: User
Tags floor function tld

OPENTLD algorithm is what to do, I do not introduce more, many people have introduced the predecessors. My reference to the blog has

Discovering TLD (v)--a frog in the well

Opentld C + + tries vehicle target tracking [1]

Look at this is very fun, I would like to compile their own run to see.

My environment is Win7 + vs2010 originally installed a opencv2.3.1 (also downloaded on the Internet, not the kind of self-compiled installation, so there are some engineering documents, this let me in the compilation of the Opentld time to make it clear)

First download opentld, download the URL is:

Https://github.com/alantrrs/OpenTLD

Downloaded after the decompression to the C drive, my OpenCV is also in the C drive.

Then to use CMake to generate VS2010 project files, you need to download CMake, download the address:

Http://www.cmake.org/files/v2.8/cmake-2.8.10.2-win32-x86.exe

After the installation of the download, you need to set the environment variables, add (this according to your own OPENCV installation path)

Opencv_dir=c:\opencv\build

The next step is to find "Visual Studio command Prompt (2010)" From the Start menu, go to the command line, CD to your extracted Opentld directory, then execute the following command.

mkdir Build

CD Build

CMake. /src/

This process error, said can not find the Findopencv.cmake file,

This time to download the Findopencv.cmake file on the Internet, the address is http://opencv.willowgarage.com/wiki/ Findopencv.cmake, copy the contents of Findopencv.cmake in this page and save it to the SRC directory. Re-execute cmake. The/src/should be successful.

(My OpenCV 2.3.1 is downloaded on the Internet, do not need to compile themselves, so there is a problem in the process, Hint less opencvconfig.cmake file, find to find out no, had to re-use CMake command to OPENCV the build directory to execute a bit cmake. /src/, the build succeeds, and then the CMake is executed in the Opentld build directory. /src/is no problem.)

After the success of the project, is imported into the vs2010, compiled execution, tragic, prompt error, in the Internet to find some information, carefully read my reference to the first article after the reply, finally compiled through, the process is as follows:

The error fixes that are encountered during the compilation process are summarized as follows:
1. The Ceil function called by the Tld::bbpoints function forces the argument type to be converted to double.
2, VS2010 does not exist round function, re-write a
int round (float f)
{
if ((int) f+0.5>f)
return (int) F;
Else
return (int) f + 1;
}

Or change the round to Cvround.
3. In the TLD::CLUSTERBB function, the VS does not support this dynamic array allocation.
float l[c-1]; Level
int nodes[c-1][2];
int belongs[c];
Change to pointer and dynamically allocate memory
float *l = new float [c-1]; Level
int **nodes = new int *[c-1];
for (int i = 0; i < 2; i + +)
Nodes[i] = new int [c-1];
int *belongs = new int [c];
Remember to release allocated memory at the end of the function
delete [] L;
L = NULL;
for (int i = 0; i < 2; ++i)
{
Delete [] nodes[i];
Nodes[i] = NULL;
}
delete []nodes;
nodes = NULL;
delete [] belongs;
belongs = NULL;
4. Where the floor function is called, the argument coercion type is converted to double

After all the errors have been modified by the method described above, save the compilation, OK the whole process is complete.


The relevant engineering documents and source code uploaded to the csdn download area, you can download: opentld Source code and VS2010 project

http://download.csdn.net/detail/benshu_001/4934079



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.