安装opencv和opencv_contrib
时间: 2023-11-08 22:04:54 浏览: 214
opencv_contrib_install
安装 OpenCV 和 OpenCV_contrib 可以按照以下步骤进行:
1. 安装依赖项:
```
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python3.5-dev python3-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
```
2. 下载 OpenCV 和 OpenCV_contrib:
```
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 4.5.1
cd ..
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout 4.5.1
cd ..
```
3. 编译和安装 OpenCV:
```
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
make -j4
sudo make install
```
阅读全文