ubuntu 编译 opencv3.4.16
时间: 2023-11-08 21:49:18 浏览: 94
以下是在 Ubuntu 系统上编译 OpenCV 3.4.16 的步骤:
1. 更新系统软件包:
```
sudo apt-get update
sudo apt-get upgrade
```
2. 安装依赖项:
```
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libjpeg-dev libpng-dev libtiff-dev libv4l-dev libxvidcore-dev libx264-dev libatlas-base-dev gfortran python3-dev python3-numpy libtbb-dev libqt5opengl5-dev
```
3. 下载 OpenCV 3.4.16:
```
mkdir ~/opencv_build && cd ~/opencv_build
wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.16.zip
unzip opencv.zip
```
4. 编译 OpenCV 3.4.16:
```
cd opencv-3.4.16
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j$(nproc)
sudo make install
```
5. 配置 OpenCV 环境变量:
```
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
```
完成以上步骤后,就可以在 Ubuntu 系统上使用 OpenCV 3.4.16 了。
阅读全文