安装cv2:
参考链接:本文链接:https://blog.csdn.net/y459541195/article/details/102055866
将镜像烧录到sd卡,并在boot中添加一个空ssh文件。
1.更换为国内源:
sudo nano /etc/apt/sources.list
2注释掉之前的,添加如下两行:
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ buster main contrib non-free rpi
ctrl+O , enter键写入保存,ctrl+X退出.
3.为了pip安装软件快一点,增加一个国内pip源:
sudo nano /etc/pip.conf
4.添加一行(其它不动):
index-url = https://mirrors.aliyun.com/pypi/simple
接着执行:
sudo apt-get update
6.安装一下google-pinyin输入法:
sudo apt-get install fcitx fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin
最后重启:
reboot
2.先扩展系统再瘦身
扩展:
sudo raspi-config
选择7,再选择A1
(enter)确认后重启
再瘦身:
关于系统瘦身请参考这篇博文进行操作:https://blog.csdn.net/y459541195/article/details/100941099
2.安装OpenCV相关依赖包
1.更新和升级软件包:
sudo apt-get update
sudo apt-get upgrade
2安装图像I/O包:
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng-dev
3.安装视频I/O包,方便获取 视频流:
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
4.为编译 highgui模块,我们需要安装GTK开发库:
sudo apt-get install libfontconfig1-dev libcairo2-dev
sudo apt-get install libgdk-pixbuf2.0-dev libpango1.0-dev
sudo apt-get install libgtk2.0-dev libgtk-3-dev
5.安装一些额外项来优化opencv许多内部操作(如矩阵操作):
sudo apt-get install libatlas-base-dev gfortran
6.安装适用于HDF5数据集和Qt GUI:
sudo apt-get install libhdf5-dev libhdf5-serial-dev libhdf5-103
sudo apt-get install libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5
7.安装OpenCV
安装opencv:
pip3 install opencv-contrib-python
8.安装numpy库
pip3 install numpy
9.安装dlib库
pip3 install dlib
10.安装scipy库
pip3 install scipy
开启相关服务
1.开启摄像机服务
2.开启vnc服务
3.扩大gpu显存