Ubuntu16.04 source code installation opencv3.4.0

Ubuntu16.04 source code installation opencv3.4.0

opencv download address: https://opencv.org/releases/page/3/
1. Download the installation package
2. Install dependencies

 sudo apt-get install build-essential libgtk2.0-dev libvtk5-dev libjpeg-dev libtiff5-dev libjasper-dev libopenexr-dev libtbb-dev

3. Unzip the installation package

unzip opencv-3.4.0.zip

4. Create a build folder in the unzipped folder

cd opencv-3.4.0/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

5. Compile

make -j4

6. Install after compilation is completed

sudo make install

7. After successful installation, configure the environment.

sudo gedit /etc/ld.so.conf.d/opencv.conf

At the end of the file add:

/usr/local/lib

sudo ldconfig

8. Add to global environment variables

sudo vim /etc/profile
在该文件最后添加
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

9. Verification version

pkg-config --modversion opencv

Guess you like

Origin blog.csdn.net/qq_25105061/article/details/111035675