【opencv】树莓派上OpenCV-Face-Recognition人脸识别配置

针对github上:https://github.com/Mjrovai/OpenCV-Face-Recognition


$pip3 install opencv-python #安装opencv
$pip3 install opencv-contrib-python #安装opencv的contrib扩展包

$sudo apt-get install libhdf5-serial-dev  //python3报错
$sudo apt-get install libatlas-base-dev 
$sudo apt-get install libjasper-dev
$sudo apt-get install libqt4-dev

$git clone https://github.com/Mjrovai/OpenCV-Face-Recognition.git
$sudo modprobe bcm2835-v4l2 //sudo vcgencmd get_camera 检查摄像头
$python 01_face_dataset.py

要新建一个文件夹dataset,保存截图
$python3 01_face_dataset.py   
输入:id 1,2,3。。

要新建一个文件夹trainer,用来保存训练结果
$python3 02_face_training.py

要双击打开03_face_recognition.py这个文件,修改names = ['None', 'Marcelo', 'Paula', 'Ilza', 'Z', 'W'] ,第二个是id=1的人的名字,第三个是id=2的人的名字,第四个是id=3的人的名字,修改后ctrl+s保存,
$python3 03_face_recognition.py

报错信息:

1、Could not find a version that satisfies the requirement

可能由于pip版本太旧,更新pip或者pip3(看你使用哪个)

可能不存在对应版本的opencv-python库,具体到底又没有可以去https://www.piwheels.org/simple/查询,

这里查到的都是3.2版本后的,所以只能用pip3下载


2、树莓派摄像头打不开问题

https://blog.csdn.net/lynn_coder/article/details/79687939

3、pip更新后找不到问题/usr/bin/pip: No such file or directory pip can no longer be found:

可以采用以下方式解决

$which pip 
/usr/local/bin/pip

$pip 
-su: /usr/bin/pip: No such file or directory

$type pip 
pip is hashed (/usr/bin/pip) 
So pip is definintely in /usr/local/bin/pip but it is been cached as in /usr/bin/pip, thanks to the Stackoverflow question, the solution is very simple:

$hash -r 
When the cache is clear, pip is working again.

4、源问题

下面给出树莓派stretch版本换清华源的方法:
树莓派的镜像文件在/etc/apt/sources.list中

ctrl+o保存 ctrl+x退出
sudo vim /etc/apt/sources.list
用#注释掉原文件内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi


猜你喜欢

转载自blog.csdn.net/qq_15947787/article/details/80938641