matlab调用opencv的函数
来源:互联网 发布:mv播放器软件 编辑:程序博客网 时间:2024/05/01 22:46
由于工作需要,需要使用Matlab 中的mexFunction调用C++程序, 该 mex function里又要用到opencv中的lib,所以在编译mex的时候,需要将opencCv的lib加到matlab的环境中。
系统环境: win XP
系统环境: win XP
matalb: matalb 2010a
c++ compiler: visual studio 2008
首先先设定matlab所选定的compiler:
1. matlab command: mex -setup
c++ compiler: visual studio 2008
首先先设定matlab所选定的compiler:
1. matlab command: mex -setup
(C:\Users\xxx\AppData\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat 为预设的的mex option file)
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[1] Microsoft Visual C++ 2008 SP1 in C:\Program Files (x86)\Microsoft Visual Studio 9.0
[0] None
Compiler: 1
Please verify your choices:
Compiler: Microsoft Visual C++ 2008 SP1
Location: C:\Program Files (x86)\Microsoft Visual Studio 9.0
Are these correct [y]/n? y
***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2008 require
that Microsoft Visual Studio 2008 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\xxx\AppData\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2010a\bin\win64\mexopts\msvc90opts.bat
Done . . .
**************************************************************************
2. 修改mexopt.bat
由于opencv所放置的路径为: D:\Program Files\OpenCV2.1\vc2008所以修改mexopts.bat(路径可以通过在Matlab中输入mex -v 得到),请参考,红色字体为添加和修改的部分:
set OPENCVDIR=D:\Program Files\OpenCV2.1\vc2008
set MATLAB=%MATLAB%
set VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0
set VCINSTALLDIR=%VSINSTALLDIR%\VC
rem In this case, LINKERDIR is being used to specify the location of the SDK
set LINKERDIR=C:\Program Files\\Microsoft SDKs\Windows\v6.0A\
set PATH=%VCINSTALLDIR%\bin\amd64;%LINKERDIR%\bin\x64;%VCINSTALLDIR%\BIN;%VSINSTALLDIR%\Common7\Tools;%VSINSTALLDIR%\Common7\Tools\bin;%MATLAB_BIN%;%PATH%
set INCLUDE=%LINKERDIR%\include;%VCINSTALLDIR%\ATLMFC\INCLUDE;%VCINSTALLDIR%\INCLUDE;%VCINSTALLDIR%\VCPackages;%INCLUDE%;%OPENCVDIR%\include\opencv
set LIB=%LINKERDIR%\LIB\x64;%VCINSTALLDIR%\LIB\amd64;%VCINSTALLDIR%\ATLMFC\LIB\amd64;%MATLAB%\extern\lib\win64;%LIB%;%OPENCVDIR%\lib;%OPENCVDIR%\bin
...略...
set LINKFLAGS=/dll /export:%ENTRYPOINT% /LIBPATH:"%LIBLOC%" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"%LIB_NAME%.x" /MAP:"%OUTDIR%%MEX_NAME%%MEX_EXT%.map" cv210.lib HighGUI210.lib cxcore210.lib cv210d.lib HighGUI210d.lib cxcore210d.lib
3. build mex: mex xxx.cpp
转自:http://hi.baidu.com/ykaitao/item/4f2d4ad0b31760332b35c786,略有修改。
- matlab调用opencv的函数
- matlab调用opencv的函数
- Matlab中调用OpenCV函数
- 在Matlab中调用OpenCV函数
- matlab 函数的调用
- OpenCV学习笔记(12)OpenCV调用Matlab函数进行保存视频的尝试
- matlab 调用opencv函数方法及matlab编译c++程序
- Matlab调用opencv库函数的具体应用
- matlab调用opencv库
- matlab调用opencv
- Matlab调用Opencv
- Matlab 到 OpenCv 的常见函数转换
- matlab与opencv部分函数的对照
- matlab与opencv部分函数的对照 .
- Matlab 到 OpenCv 的常见函数转换
- Matlab 到 OpenCv 的常见函数转换
- opencv、matlab查看函数的定义、封装
- OpenCV实现Matlab的fft2、ifft2函数
- nagios+nginx从环境搭建到配置
- Linux下Nginx+Tomcat整合的安装与配置
- Query By Criteria
- oracle 数据迁移工具 oracle sql developer的使用(4)
- linux打印中时间信息 .
- matlab调用opencv的函数
- 注册表中性能计数器名称字符串数值的格式不正确
- yii findall 使用方法
- CCNA网络系列实验(1)之GNS3安装配置指南
- Nagios安装手册
- 口袋中有红黄蓝白黑5种颜色的球若干个。每次从口袋中任意取出三个球,问得到3中不通过颜色的球的可能取法。(枚举)
- oracle 数据迁移工具 oracle sql developer的使用(5)
- jmail 组件收发邮件 WSAGetLastError() 错误.
- Hibernate API 简介