搭建編譯環(huán)境躬络,并安裝相關(guān)關(guān)聯(lián)庫
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
下載opencv并且編譯
git clone https://github.com/opencv/opencv.git
cd opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make
sudo make install
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
測試安裝
切換到samples目錄下面,并編譯samples程序
cd ../samples/
sudo cmake .
sudo make -j $(nproc)
然后切換到cpp目錄下運(yùn)行測試程序
cd cpp/
./cpp-example-facedetect XX (圖片路徑)
顯示圖像趴乡,測試成功