Intro
單純用 library 的話sudo apt-get install libopencv-dev
其它安裝方法
基本上, 完全照著文章做, 這邊留記錄
sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen3-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev default-jdk ant libvtk5-qt4-dev
Content
cd ~ wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip unzip opencv-2.4.9.zip cd opencv-2.4.9Build的時間有點長
mkdir build cd build cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON ..build好可以安裝了
make sudo make install安裝完後可以設定OpenCV
sudo gedit /etc/ld.so.conf.d/opencv.conf在這個Config檔中加入下面這行(它可能是空的, 那是OK的)然後儲存它
/usr/local/lib用這個來設定library
sudo ldconfig開啟這個檔案
sudo gedit /etc/bash.bashrc在最後加入下述兩行
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH最後重啟你的電腦
後面有些Sample可以執行來看看
到解壓縮的路徑下執行sample程式
cd ~/opencv-2.4.9/samples/c chmod +x build_all.sh ./build_all.sh ./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg
沒有留言:
張貼留言