树莓派安装opencv
时间: 2023-07-07 13:46:43 浏览: 149
树莓派OpenCV安装
5星 · 资源好评率100%
好的,下面是树莓派安装 OpenCV 的步骤:
1.首先更新树莓派的软件包列表:
```
sudo apt-get update
```
2.安装 OpenCV 的依赖库:
```
sudo apt-get install build-essential cmake pkg-config libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk2.0-dev libatlas-base-dev gfortran python2.7-dev python3-dev
```
3.下载 OpenCV 的源代码:
```
cd ~
wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.0.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.4.0.zip
unzip opencv.zip
unzip opencv_contrib.zip
```
4.编译并安装 OpenCV:
```
cd ~/opencv-3.4.0/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.0/modules -D ENABLE_NEON=ON -D ENABLE_VFPV3=ON -D BUILD_TESTS=OFF -D OPENCV_ENABLE_NONFREE=ON -D INSTALL_PYTHON_EXAMPLES=OFF -D BUILD_EXAMPLES=OFF ..
make -j4
sudo make install
sudo ldconfig
```
5.确认 OpenCV 已经安装成功:
```
pkg-config --modversion opencv
```
以上是在树莓派上安装 OpenCV 的基本步骤,希望能对你有所帮助。
阅读全文