UBUNTU安装opencv
时间: 2024-04-02 18:30:32 浏览: 109
ubuntu opencv安装
3星 · 编辑精心推荐
安装OpenCV在Ubuntu上可以按照以下步骤进行:
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 libdc1394-22-dev
```
3. 克隆OpenCV源代码:
```
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout <version> # 替换<version>为你想要安装的OpenCV版本号,例如:4.5.2
```
4. 创建并进入构建目录:
```
mkdir build
cd build
```
5. 配置编译选项:
```
cmake ..
```
6. 编译并安装OpenCV:
```
make -j$(nproc)
sudo make install
```
7. 配置动态链接库:
```
sudo ldconfig
```
完成以上步骤后,OpenCV就成功安装在Ubuntu上了。
阅读全文