git clone https://github.com/opencv/opencv.git
cd opencv
mkdir build
mkdir install
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/path/to/opencv/install ..
(這裡可以根據需求加入參數 -D xxx)
make -j7
make install
使用範例:
g++ -Wall main.cpp -I/path/to/opencv/install/include -L/path/to/opencv/install/lib -ldl -lm -lpthread -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_objdetect
參考資料:
http://docs.opencv.org/trunk/d7/d9f/tutorial_linux_install.html
沒有留言:
張貼留言