我有一个 .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/