TLD学习(1)-搭建环境
来源:互联网 发布:大数据与中国发展 编辑:程序博客网 时间:2024/06/14 02:52
1. 搭载环境
步骤1:下载Demo: Zdenek Kalal的openTLD,见https://github.com/zk00006/OpenTLD
步骤2:安装Matlab2014b,VS2013,OpenCV2.4.9(需要将dll路径添加到环境变量的path中)
步骤3:设置编译器:mex -setup,选择VS2013
步骤4:修改compile.m,执行
步骤5:执行run_TLD.m
2. 编译
将compile.m文件修改如下(如果想要在cpp中debug,需要在mex后添加'-g',见点击打开链接):
% Copyright 2011 Zdenek Kalal%% This file is part of TLD.%% TLD is free software: you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation, either version 3 of the License, or% (at your option) any later version.%% TLD is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.%% You should have received a copy of the GNU General Public License% along with TLD. If not, see <http://www.gnu.org/licenses/>.% Compiles mex filesclc; clear all; cd mex;if ispc disp('PC'); include = ' -Id:\opencv\build\include\opencv\ -Id:\opencv\build\include\'; libpath = 'd:\opencv\build\x64\vc12\lib\'; files = dir([libpath '*.lib']); lib = []; for i = 1:length(files), lib = [lib ' ' libpath files(i).name]; end eval(['mex lk.cpp -O' include lib]); mex -O -c tld.cpp mex -O fern.cpp tld.obj mex -O linkagemex.cpp mex -O bb_overlap.cpp mex -O warp.cpp mex -O distance.cppendif ismac disp('Mac'); include = ' -I/opt/local/include/opencv/ -I/opt/local/include/'; libpath = '/opt/local/lib/'; files = dir([libpath 'libopencv*.dylib']); lib = []; for i = 1:length(files), lib = [lib ' ' libpath files(i).name]; end eval(['mex lk.cpp -O' include lib]); mex -O -c tld.cpp mex -O fern.cpp tld.o mex -O linkagemex.cpp mex -O bb_overlap.cpp mex -O warp.cpp mex -O distance.cpp endif isunix disp('Unix'); include = ' -I/usr/local/include/opencv/ -I/usr/local/include/'; libpath = '/usr/local/lib/'; files = dir([libpath 'libopencv*.so.2.2']); lib = []; for i = 1:length(files), lib = [lib ' ' libpath files(i).name]; end eval(['mex lk.cpp -O' include lib]); mex -O -c tld.cpp mex -O fern.cpp tld.o mex -O linkagemex.cpp mex -O bb_overlap.cpp mex -O warp.cpp mex -O distance.cpp endcd ..disp('Compilation finished.');
3.TroubleShooting
Error: 无法找到"Program Files..."
解决办法:include和libpath中的opencv路径不能有空格。将opencv的安装包extract到别的盘符下,重新cmake一遍,再用vs编译一遍。见《opencv3编程入门》
Error: 错误使用 mex
正在创建库 lk.lib 和对象 lk.exp
lk.obj : error LNK2019: 无法解析的外部符号 cvAlloc,该符号在函数 mexFunction 中被引用....
解决办法:对于x64系统,需将libpath = 'd:\opencv\build\x86\vc12\lib\';改为libpath = 'd:\opencv\build\x64\vc12\lib\';
Error: c:\Matlab\r2014b\extern\include\matrix.h(266) : error CC4430:缺少类型说明符 -假定为int。注意:C++不支持int
解决办法:
在lk.cpp, fern.cpp, and bb_overlap.cpp中注释掉这些代码: #ifdef _CHAR16_T #define CHAR16_T #endif
Error: bb_overlap.cpp(35) : error C3861: “min”: 找不到标识符
解决办法:修改TLD代码包中mex文件夹下bb_overlap.cpp文件,在头部加上#include "minmax.h"
Error: 找不到 'FSPECIAL' 的完全匹配项(区分大小写)。
解决办法:h = FSPECIAL('gaussian',csize,sigma);改为fspecial
Error:Invalid MEX-file 'D:\TLD\OpenTLD-master\mex\lk.mexw64':找不到指定的模块
解决办法:虽然安装了OpenCV,但是没有将DLL添加到Path中,lk.mexw64(其实也是个DLL)就会找不到关于opencv的DLL。在环境变量->系统变量->Path中添加openCV的dll路径,如d:\opencv\build\x64\vc12\bin. (x64指64位系统,vc12指vs2013),改完后要重启系统。原帖:https://github.com/kyamagu/mexopencv#2-install-opencv-library
解决办法:按空格退出
- TLD学习(1)-搭建环境
- TLD算法环境搭建
- TLD学习(3) arthurv版TLD
- TLD学习笔记1
- TLD学习(一)
- TLD 代码学习(一)
- TLD(1)
- Hibernate学习手记(1)--搭建环境
- XNA学习笔记(1)-环境搭建
- php学习笔记(1)- 环境搭建
- android开发学习(1)---环境搭建
- cocos2dx开发学习(1)---环境搭建
- DM6446学习(1环境搭建)
- Mybatis学习(1)开发环境搭建
- Java学习笔记(1)--环境搭建
- Mybatis学习(1)开发环境搭建
- (Qt学习1)Qt环境搭建
- django学习笔记(1)环境搭建
- 南阳OJ 背包问题
- 项目 代码 对比 android 快速对比差别
- cocos2d 用MotionStreak给骨骼动画的刀加拖尾(刀光拖尾)
- CodeForces 560A(货币系统)
- 欢迎使用CSDN-markdown编辑器
- TLD学习(1)-搭建环境
- poj 2337 Catenyms 【欧拉路径】
- 纸上谈兵: 树, 二叉树, 二叉搜索树
- 科莫中文离线地图App上线
- OC07_类的扩展
- BIOS 工作原理
- java多线程学习笔记——yield()、wait()、sleep()等方法
- 内存池
- 在Cocos2d-Lua中使用ProtoBuf(Xcode配置方法)