2013年5月21日 星期二

[MAC] 安裝 OPENCV


1.安裝xcode 在apple store 下載 安裝完command line tools後 在終端機執行 確認一下是否安裝成功
$ c++ --version
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

$ g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2.安裝 CUDA toolkit https://developer.nvidia.com/cuda-toolkit 同樣安裝完後執行確認
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2012 NVIDIA Corporation
Built on Fri_Sep_28_16:10:16_PDT_2012
Cuda compilation tools, release 5.0, V0.2.1221
3.安裝cmake 可以用macport 或是 homebrew 或是到官網下載 http://www.cmake.org/cmake/resources/software.html 4.安裝OpenEXR http://www.openexr.com/downloads.html openexr 還有ilmbase 也要順便裝
./configure --prefix=/usr/local
make check
sudo make install
5.最後是opencv 去官網抓 目前release版是2.4.3
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -D BUILD_OPENEXR=OFF ..
make
sudo make install
6.安裝完成後記得設定路徑
OPENCV_LIBPATH=/usr/local/lib
OPENCV_INCLUDEPATH=/usr/local/include
CUDA_INCLUDEPATH=/usr/local/cuda/include
CUDA_LIBPATH=/usr/local/cuda/lib
參考: http://forums.udacity.com/questions/100021223/installing-opencv-on-os-x-mountain-lion

2 則留言: