目录
一、准备工作
(一)安装OpenCV
pip install opencv-python
#安装适用于Python版本的OpenCV
找到分类器位置
(二)安装face-recognition
Face Recognition
Recognize and manipulate faces from Python or from the command line with
the world’s simplest face recognition library.
Built using dlib’s state-of-the-art face recognition
built with deep learning. The model has an accuracy of 99.38% on the
Labeled Faces in the Wild benchmark.
This also provides a simple
face_recognition
command line tool that letsyou do face recognition on a folder of images from the command line!
在安装face-recognition时,需要先安装cmake以及dlib。安装dlib时,遇到了报错,经分析,是电脑缺少了C++环境。
解决方法如下:
1、到微软官网下载Visual Studio 2019
下载地址:Visual Studio IDE: 面向开发人员的一体式编程工具
2、安装Visual Studio Installer
3、在软件界面,选择安装“使用C++的桌面开发”
4、等待安装完成后,重启计算机
5、再次在命令中输入“pip install dlib”,安装成功
注意:安装需要较长时间,切记做好数据保存及备份。
二、操作实例
(一)基础人脸识别 OpenCV
1、代码实现
引入第三方库
import cv2
import matplotlib.pyplot as plt