树莓派安装c++opencv
时间: 2023-09-10 10:07:07 浏览: 154
嵌入式大作业在树莓派上进行开发,使用c++下的opencv和SURF算法实现了图像的特征匹配+源代码+文档说明+ 实验报告
您可以按照以下步骤在树莓派上安装C++ OpenCV:
1. 更新系统软件包:
```
sudo apt update
sudo apt upgrade
```
2. 安装必要的依赖项:
```
sudo apt install build-essential cmake git pkg-config
sudo apt install libjpeg-dev libtiff5-dev libjasper-dev libpng-dev
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt install libxvidcore-dev libx264-dev
sudo apt install libgtk-3-dev
sudo apt install libcanberra-gtk*
sudo apt install libatlas-base-dev gfortran
sudo apt install python3-dev
```
3. 下载OpenCV源代码:
```
cd ~
mkdir opencv
cd opencv
git clone https://github.com/opencv/opencv.git
```
4. 下载OpenCV贡献模块(可选):
```
cd ~
mkdir opencv_contrib
cd opencv_contrib
git clone https://github.com/opencv/opencv_contrib.git
```
5. 编译和安装OpenCV:
```
cd ~/opencv/opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/opencv_contrib/modules \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D BUILD_TESTS=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON ..
make -j4
sudo make install
sudo ldconfig
```
6. 验证安装:
```
pkg-config --modversion opencv4
```
现在,您已经成功在树莓派上安装了C++版OpenCV。
阅读全文