2014-10-01 224 views
2

我想通過我的Mac上安裝mexopencv接口Matlab和OpenCV的,我有以下錯誤信息:錯誤安裝mexopencv

>> 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的。你有什麼建議如何使安裝工作?謝謝!

+0

'安裝在Mac上mexopencv'是我所經歷過的最大的痛。但是,我設法按照以下說明使其工作:http://stackoverflow.com/questions/19773916/compiling-mexopencv-in-os-x-10-9-with-xcode-5-and-matlab- r2013b。不知道這些是否適合你,但試試吧! – rayryeng 2014-10-02 03:13:17

+1

'mexopencv.make'函數[調用](https://github.com/kyamagu/mexopencv/blob/master/%2Bmexopencv/make.m#L162)系統的'make'來執行'Makefile'。這反過來[使用](https://github.com/kyamagu/mexopencv/blob/master/Makefile#L16)'pkg-config'來找到OpenCV頭和共享庫。所以你必須在PATH上有'pkg-config'。所以如果你打開一個終端並輸入'pkg-config --cflags --libs opencv',你應該得到已安裝的OpenCV庫的編譯和鏈接標誌。如果沒有,請安裝'pkg-config'並將其添加到PATH,然後相應地設置'PKG_CONFIG_PATH' – Amro 2014-10-02 19:10:57

+1

此主題可能有所幫助:https://github.com/kyamagu/mexopencv/issues/71 – Amro 2014-10-02 19:14:47

回答

0

爲了解決這個問題,我簡單地更換其稱爲豬的配置是這樣的線路:

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

其中輸出是我從運行pkg配置了從終端--cflags OpenCV的。對於CV_LDFLAGS,也可以使用--libs來執行此操作,並刪除上面那個調用pkg-config --exists opencv etc的檢查。

我得到的下一個錯誤是一些-lippicv相關的事情,我通過將其添加到Makefile中來解決這個問題。

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