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

标签 linux matlab opencv mex

我有一个 .cpp,我正在尝试在 Ubuntu 14.04 中使用 MATLAB R2011a 进行混合。该文件使用了一些 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 进行编译,但它仍然崩溃。我做错了什么?

最佳答案

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

关于linux - 不能在 Linux 的 Matlab 中包含 OpenCV 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26565614/

相关文章:

javascript - socket.send() 不适用于 Opera 11.10

linux - 在 Asterisk 中同时播放和录制

matlab - 为什么 MATLAB R2021a 中的散点图颜色不同?

c++ - 使用 CMake 编译静态可执行文件

网络驱动器上的 python fsync() 挂起

regex - Matlab - 如何替换向量中的所有特殊字符?

matlab - 如何将变量移入和移出类似于 MATLAB 中的 LOAD 和 SAVE 的结构?

javascript - 从网络摄像头捕获视频并使用 nacl - opencv 处理它们

python - 为什么 Python cv2 模块依赖于(旧的)cv

c - C 中 fgetc() 函数的行为