Ubuntu20.0.4安装opencv3.2+opencv3.2扩展
时间: 2023-08-15 22:08:59 浏览: 126
好的,下面是在 Ubuntu 20.04 上安装 OpenCV 3.2 和其扩展的步骤:
1. 更新系统软件包:
```
sudo apt update
sudo apt upgrade
```
2. 安装依赖项:
```
sudo apt install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt install python3-dev python3-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
```
3. 下载 OpenCV 3.2 源代码:
```
git clone --branch 3.2.0 https://github.com/opencv/opencv.git
cd opencv
```
4. 创建一个构建目录:
```
mkdir build
cd build
```
5. 配置 OpenCV:
```
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
```
6. 编译并安装 OpenCV:
```
make -j$(nproc)
sudo make install
```
7. 安装 OpenCV 扩展:
```
cd ..
git clone --branch 3.2.0 https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
```
8. 创建一个构建目录:
```
mkdir build
cd build
```
9. 配置 OpenCV 扩展:
```
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../modules ..
```
10. 编译并安装 OpenCV 扩展:
```
make -j$(nproc)
sudo make install
```
至此,您已经成功安装了 OpenCV 3.2 和其扩展。
阅读全文