Ubuntu中Qt5.7.0的安裝及opencv2.4.13配置

去官網下載qt-opensource-linux-x64-5.7.0.run,到「下載」目錄python

Ctrl+Alt+T打開終端linux

cd /home/jv/下載
sudo mv qt-opensource-linux-x64-5.7.0.run /opt
cd /opt   我的習慣把軟件安裝到opt文件夾中
sudo chmod +x qt-opensource-linux-x64-5.7.0.run
sudo ./qt-opensource-linux-x64-5.7.0.runbash

彈出熟悉的GUI,默認安裝便可app

【圖標放到左側任務欄】ui

1.進入這個文件夾spa

/usr/share/applicationscode

2.找到安裝QT圖標orm

3.直接拖到側邊菜單欄,就好了ip

【配置opencv】qt

sudo apt install qt-sdk
sudo apt install cmake
sudo apt install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen2-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

解壓下載的opencv壓縮包(個人在下載目錄),解壓後放到opt文件夾(不然make過程容易出錯),而後在opencv目錄下新建Release文件夾
cd /home/jv/下載
unzip opencv-2.4.13.zip
sudo mv /home/jv/下載/opencv-2.4.13 /opt
cd opencv-2.4.13/
sudo mkdir Release
cd Release

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -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_GTK=ON -D WITH_OPENGL=ON ..

make
sudo make install

將opencv加入系統環境變量

sudo gedit /etc/ld.so.conf
在下一行加入
/usr/loacal/lib
保存,關閉
sudo ldconfig

sudo gedit /etc/bash.bashrc
末尾加入
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
保存,關閉
source /etc/bash.bashrc

opt目錄中的opencv文件夾能夠刪除,節省空間

sudo rm -r /opt/opencv-2.4.13/

完成!!!

相關文章
相關標籤/搜索