ubuntu18.04安装配置opencv3.4.0

1.安装配置相关工具及依赖库

sudo apt-get install build-essential
# 必须的,gcc编译环境

sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
# 必须的,包括cmake等工具

sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
# 可选的,看个人需要,总共5M左右

2.从官网下载源码

官网地址:https://opencv.org/releases.html

3.cmake

cd opencv-3.4.0
mkdir build
# 创建编译文件
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
# 生成后的Makefile在build文件夹中,而需要的CMakeLists.txt在 ".."中,即上一级文件夹中(opencv-3.4.0)

4.安装opencv

# 4个线程编译,查看cpu核数量
# grep "model name" /proc/cpuinfo | wc -l 
make -j4

# 安装
sudo make install

5.测试

测试安装是否成功: http://blog.csdn.net/u011440558/article/details/78213796

6.参考

https://blog.csdn.net/u011440558/article/details/78358447

转载于:https://www.cnblogs.com/chendl111/p/9461154.html

你可能感兴趣的:(ubuntu18.04安装配置opencv3.4.0)