不能在Linux中的Matlab中包含OpenCV函数

时间:2014-10-25 18:12:39

标签: linux matlab opencv mex

我在Ubuntu 14.04中使用MATLAB R2011a尝试使用.cpp。该文件使用一些OpenCV函数并导入相应的库:

#include <opencv/cv.h>

我在Matlab中使用以下命令:

mex -I/usr/local/include FaceDetect.cpp

由于opencv库安装在/ usr / local / include / opencv中。崩溃结果如下:

Warning: You are using gcc version "4.8.2-19ubuntu1)".  The version
     currently supported with MEX is "4.3.4".
     For a list of currently supported compilers see: 
     http://www.mathworks.com/support/compilers/current_release/

FaceDetect.o: In function `mexFunction':
FaceDetect.cpp:(.text+0xc6): undefined reference to `cvLoad'
FaceDetect.cpp:(.text+0x132): undefined reference to `cvCreateMemStorage'
FaceDetect.cpp:(.text+0x155): undefined reference to `cvCreateImage'
FaceDetect.cpp:(.text+0x23a): undefined reference to `cvHaarDetectObjects'
FaceDetect.cpp:(.text+0x285): undefined reference to `cvGetSeqElem'
FaceDetect.cpp:(.text+0x354): undefined reference to `cvReleaseImage'
FaceDetect.cpp:(.text+0x393): undefined reference to `cvClearMemStorage'
FaceDetect.cpp:(.text+0x39f): undefined reference to `cvReleaseHaarClassifierCascade'
collect2: error: ld returned 1 exit status

     mex: link of ' "FaceDetect.mexa64"' failed.

??? Error using ==> mex at 208
Unable to complete successfully

我尝试使用-L和-lcv进行编译,但它仍然崩溃。我做错了什么?

1 个答案:

答案 0 :(得分:0)

计算机视觉系统工具箱现在包含support package for OpenCV interface。它包含一个MATLAB和OpenCV数据类型之间的转换例程库,以及一个使用OpenCV编译mex函数的简单方法。