对DPM算法源码voc-release3.1在windows环境中matlab运行的修改

DPM算法是用来做目标识别的。一份matlab的源码可以从这里下到:http://cs.brown.edu/~pff/latent-release3/

作者给出的源码是在mac环境下使用matlab编译和运行的。

而大多数人的工作环境还是在windows下运行matlab,关键是源码中的cc文件,即c++的源文件,是使用 visual studio c++编译的,由于不同的编译器对于C的标准支持不一样,比如math.h中,有的就不包含round和trunc函数,这就需要hack一下。

本人已对此源码进行修改,在matlab R2014a下已经可以使用。源码已经上传到http://download.csdn.net/download/qiuchangyong/9971551,欢迎有问题,相互探讨。

该代码需要首先编译,因为matlab调用c++代码需要一个mexw文件,可能会遇到下面的错误:

>> compile
Error: Could not detect a compiler on local system
which can compile the specified input file(s)
Error using mex (line 206)
Unable to complete successfully.

Error in compile (line 1)
mex -O resize.cc


以上是因为没有设置mex造成的,需要使用本机的msvc编译工具,以我的开发环境为例,具体如下:

>> mex -setup
 
Welcome to mex -setup.  This utility will help you set up 
a default compiler.  For a list of supported compilers, see 
http://www.mathworks.com/support/compilers/R2011b/win64.html
 
Please choose your compiler for building MEX-files:
 
Would you like mex to locate installed compilers [y]/n? y
 
Select a compiler:
[1] Microsoft Software Development Kit (SDK) 7.1 in c:\Program Files (x86)\Microsoft Visual Studio 10.0
[2] Microsoft Visual C++ 2010 in c:\Program Files (x86)\Microsoft Visual Studio 10.0
 
[0] None
 
Compiler: 2
 
Please verify your choices:
 
Compiler: Microsoft Visual C++ 2010 
Location: c:\Program Files (x86)\Microsoft Visual Studio 10.0
 
Are these correct [y]/n? y
 
***************************************************************************
  Warning: MEX-files generated using Microsoft Visual C++ 2010 require
           that Microsoft Visual Studio 2010 run-time libraries be 
           available on the computer they are run on.
           If you plan to redistribute your MEX-files to other MATLAB
           users, be sure that they have the run-time libraries.
***************************************************************************
 
 
Trying to update options file: C:\Users\Daniel\AppData\Roaming\MathWorks\MATLAB\R2011b\mexopts.bat
From template:              C:\PROGRA~1\MATLAB\R2011b\bin\win64\mexopts\msvc100opts.bat
 
Done . . .
 
**************************************************************************
  Warning: The MATLAB C and Fortran API has changed to support MATLAB
           variables with more than 2^32-1 elements.  In the near future
           you will be required to update your code to utilize the new
           API. You can find more information about this at:
           http://www.mathworks.com/support/solutions/en/data/1-5C27B9/?solution=1-5C27B9
           Building with the -largeArrayDims option enables the new API.
**************************************************************************


这样就可以compile了


  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值