首页 技术 正文
技术 2022年11月15日
0 收藏 719 点赞 4,129 浏览 1444 个字

最近看到了TLD的跟踪视频,觉得很有意思,刚好最近在看行人检测所以就打算下载源码玩一玩,因为源码是Linux版本的(原作者写的是C++和MATLAB的混合编程)C++源码可以在我的博客TLD(一种目标跟踪算法中)下载到。在编译过程中遇到一些问题,在网上找了些资料后顺利解决了。

  1. 下载源码,然后解压,新建VS工程,配置好opencv,把C++源码下的src,include文件夹下的代码cope到新建工程下并在工程中添加
  2. 将代码中的所有包含目录下的.h文件的<>改成”“  比如#include <tld_utils.h>改成#include “tld_utils.h”
  3. opencv246中需要在TLD.h中添加#include <opencv2/legacy/legacy.hpp> //原作者没有添加这个所以出错,定义了PatchGenerator类
  4. Vs中没有round函数,所以要自己写一个,
    int round(float f)
    {
    if ((int)f+0.5>f)
    return (int)f;
    else
    return (int)f + ;
    }
  5. TLD::clusterBB函数中,vs不支持这种动态数组分配。

    float L[c-]; //Level
    int nodes[c-][];
    int belongs[c];
    //改成指针和动态分配内存
    float *L = new float [c-]; //Level
    int **nodes = new int *[c-];
    for(int i = ; i < ;i ++)
    nodes[i] = new int [c-];
    int *belongs = new int [c];
    //记得在函数末释放分配的内存
    delete [] L;
    L = NULL;
    for (int i = ; i < ; ++i)
    {
    delete [] nodes[i];
    nodes[i] = NULL;
    }
    delete []nodes;
    nodes = NULL;
    delete [] belongs;
    belongs = NULL;
  6. 上面完成之后,程序编译可以通过,摄像头也可以打开,但是一选定boundingbox程序就运行不下去了。看了一下代码才发现run_tld.cpp中有一个print_help函数。
    看了之后,明白了原来运行需要传递参数。见下面cmd命令:
    %To run from camera
    ./run_tld -p ../parameters.yml
    %To run from file
    ./run_tld -p ../parameters.yml -s ../datasets/06_car/car.mpg
    %To init bounding box from file
    ./run_tld -p ../parameters.yml -s ../datasets/06_car/car.mpg -b ../datasets/06_car/init.txt
    %To train only in the first frame (no tracking, no learning)
    ./run_tld -p ../parameters.yml -s ../datasets/06_car/car.mpg -b ../datasets/06_car/init.txt -no_tl
    %To test the final detector (Repeat the video, first time learns, second time detects)
    ./run_tld -p ../parameters.yml -s ../datasets/06_car/car.mpg -b ../datasets/06_car/init.txt -r

    这样就可以运行了

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,413
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,186
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905