Linux下安裝OpenCV步驟

1. sudo apt-get install cmakebash

    sudo apt-get install cmake-qt-guiui

    sudo apt-get install libgtk2.0-devxml

    sudo apt-get install pkg-configget

2.新建一個目錄opencv_x86做爲pc編譯目錄qt

   執行cmake-guiit

    CMAKE_BUILD_TYPE值輸入Release編譯

    WITH_QT勾選 去掉WITH_TIFFopencv

    在opencv_x86中執行make;make installgui

3.配置環境變量: sudo gedit /etc/ld.so.conf.d/opencv.conf變量

                         將/usr/local/lib寫入最後

                         執行sudo ldconfig

4.更改環境變量 sudo gedit /etc/bash.bashrc

    在文件後添加:PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

                         export PKG_CONFIG_PATH

5.將源代碼中samples中C文件夾拷出來

    ./build_all.sh

    ./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 lena.jpg

相關文章
相關標籤/搜索