我總是嘗試安裝OpenCV編譯源代碼,您會得到最新版本的OpenCV,並確保使用OpenCV創建者給出的參數完成安裝。
我認爲OpenCV中使用的cmake要安裝,在這種情況下安裝的蛋糕,在你的OpenCV目錄到build文件夾類型創建一個build文件夾cmake ..
之後,如果一切順利,你將有一個makefile
文件,執行它,然後sudo make install
。
UPDATE: 我只是測試我的答案在我的視網膜筆記本電腦,OS X 10.9.1和OpenCV 2.4.8。
Scanning dependencies of target opencv_traincascade
[ 99%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/traincascade.cpp.o
[ 99%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/cascadeclassifier.cpp.o
[100%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/boost.cpp.o
[100%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/features.cpp.o
[100%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/haarfeatures.cpp.o
[100%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/lbpfeatures.cpp.o
[100%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/HOGfeatures.cpp.o
[100%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/imagestorage.cpp.o
Linking CXX executable ../../bin/opencv_traincascade
[100%] Built target opencv_traincascade
██ memmaker6501 @ ~/Downloads/opencv-2.4.8/build
██ 11:34:46 $ cmake --version
cmake version 2.8.12.1
請注意,如果您要創建xcodeproject,則必須使用不同的參數編譯庫。