VS2010编译arthurv的C++版OpenTLD

来源:互联网 发布:手机淘宝领取淘金币 编辑:程序博客网 时间:2024/06/10 20:49

  1. 下载Alan TorresC++实现的OpenTLD zip包。
  2. 解压缩。
  3. 新建空工程(我是vs2010),取名TLDarthurv,并将解压缩下include的文件导入到TLD头head file中;并将解压缩下src的文件导入到TLD头sorce file中。
  4. 配置OpenCV;参见
  5. 修改代码中的一些问题;参见和参见


至于编译过程会遇到的错误修正总结如下:
1、TLD::bbPoints函数调用的ceil函数强制把参数类型转换为double。
2、vs2010不存在round函数,重新写一个
int round(float f)

if ((int)f+0.5>f) 
return (int)f; 
else 
return (int)f + 1; 
}

或者把round要改成cvRound。
3、TLD::clusterBB函数中,vs不支持这种动态数组分配。
float L[c-1]; //Level
int nodes[c-1][2];
int belongs[c];
改成指针和动态分配内存
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];
记得在函数末释放分配的内存
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、调用floor函数的地方,把参数强制类型转换为double

把所有错误按上面说的方法做修改后,保存编译,OK整个过程完成了。


参考资料:
1.http://www.cnblogs.com/jiutiandiwang/archive/2012/08/07/2627044.html
2.http://www.myexception.cn/vsts/1130491.html
3.http://blog.csdn.net/zdyueguanyun/article/details/8534835
4.https://github.com/arthurv/OpenTLD
5.https://github.com/zk00006/OpenTLD/wiki/Installation
6.http://blog.csdn.net/mygis2005/article/details/10472717

0 0
原创粉丝点击