安装mexopencv时出错

时间:2014-10-01 22:39:15

标签: macos matlab opencv

我正在尝试通过在我的Mac上安装mexopencv来连接Matlab和OpenCV,并且出现以下错误消息:

>> mexopencv.make
make MATLABDIR="/Applications/MATLAB_R2014a.app" MEXEXT=mexmaci64  
make: pkg-config: Command not found
make: pkg-config: Command not found
/Applications/MATLAB_R2014a.app/bin/mex -c -cxx -largeArrayDims -Iinclude  src/MxArray.cpp -outdir lib
Building with 'Xcode Clang++'.
In file included from /Users/Alberto/Documents/Data_analysis/mexopencv-master/src/MxArray.cpp:6:
include/MxArray.hpp:14:10: fatal error: 'opencv2/opencv.hpp' file not found
#include "opencv2/opencv.hpp"
         ^
1 error generated.

make: *** [lib/libMxArray.a] Error 255

我使用Brew安装了OpenCV。您对如何安装有任何建议吗?谢谢!

1 个答案:

答案 0 :(得分:0)

要解决这个问题,我只需更换名为pig-config的行:

CV_CFLAGS := -I/usr/local/Cellar/opencv3/3.1.0_3/include/opencv -I/usr/local/Cellar/opencv3/3.1.0_3/include

其中输出是我从终端运行pkg-config --cflags opencv得到的。也可以使用--libs为CV_LDFLAGS执行此操作,并删除执行pkg-config --exists opencv etc调用的上方检查。

我得到的下一个错误是一些-lippicv相关的东西,我通过将它添加到Makefile来修复。

override LDFLAGS += -L/usr/local/Cellar/opencv3/3.1.0_3/share/OpenCV/3rdparty/lib/