ubuntu 安装OpenCV3.4
时间: 2023-11-10 19:02:30 浏览: 113
ubuntu下安装OpenCV
5星 · 资源好评率100%
安装 OpenCV3.4 可以按照以下步骤进行:
1. 安装依赖项
```
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake git pkg-config
sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk-3-dev
sudo apt-get install libatlas-base-dev gfortran
```
2. 下载 OpenCV 源代码
```
cd ~
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout 3.4.0
```
3. 编译并安装 OpenCV
```
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D PYTHON_EXECUTABLE=/usr/bin/python2.7 \
-D BUILD_EXAMPLES=ON ..
make -j4
sudo make install
```
阅读全文