ubuntu下安装opencv3.4.11扩展包
时间: 2023-11-28 15:04:03 浏览: 68
以下是在Ubuntu上安装opencv3.4.11扩展包的步骤:
1. 安装依赖项
打开终端,输入以下命令安装依赖项:
```
sudo apt-get update
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libeigen3-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev sphinx-common libtesseract-dev libopencv-dev libopencv-dev python3-opencv python-opencv python3-numpy python-numpy python3-pil python-pil python3-matplotlib python-matplotlib
```
2. 下载opencv3.4.11源代码
打开终端,输入以下命令下载opencv3.4.11源代码:
```
git clone https://github.com/opencv/opencv.git -b 3.4.11
```
3. 编译安装opencv3.4.11
进入opencv源代码目录,创建build目录并进入:
```
cd opencv
mkdir build
cd build
```
执行cmake命令生成Makefile:
```
cmake ..
```
执行make命令编译opencv:
```
make -j4
```
执行make install命令安装opencv:
```
sudo make install
```
4. 安装opencv3.4.11扩展包
进入opencv源代码目录,下载opencv_contrib3.4.11扩展包:
```
cd ..
git clone https://github.com/opencv/opencv_contrib.git -b 3.4.11
```
进入opencv源代码目录的build目录,重新执行cmake命令生成Makefile:
```
cd build
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ..
```
重新执行make命令编译opencv:
```
make -j4
```
重新执行make install命令安装opencv:
```
sudo make install
```
5. 验证安装
打开终端,输入以下命令验证opencv是否成功安装:
```
pkg-config --modversion opencv
```
如果输出版本号,则表示opencv安装成功。
阅读全文