opencv4.5.0unbntu
时间: 2023-12-22 14:29:10 浏览: 85
opencv 4.5.0
5星 · 资源好评率100%
以下是在Ubuntu上安装OpenCV 4.5.0的步骤:
1. 首先,确保你的系统已经更新到最新版本:
```shell
sudo apt update
sudo apt upgrade
```
2. 安装必要的依赖项:
```shell
sudo apt install build-essential cmake git pkg-config libgtk-3-dev \
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
gfortran openexr libatlas-base-dev python3-dev python3-numpy \
libtbb2 libtbb-dev libdc1394-22-dev
```
3. 下载OpenCV 4.5.0源代码:
```shell
cd ~
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 4.5.0
```
4. 创建一个用于构建OpenCV的目录:
```shell
mkdir build
cd build
```
5. 使用CMake配置构建选项:
```shell
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D BUILD_EXAMPLES=ON ..
```
6. 编译OpenCV:
```shell
make -j$(nproc)
```
7. 安装OpenCV:
```shell
sudo make install
```
8. 配置动态链接库:
```shell
sudo ldconfig
```
现在,你已经成功在Ubuntu上安装了OpenCV 4.5.0。
阅读全文