环境要求

安装依赖模块

依赖安装方式一:

在终端使用以下命令安装依赖包,其中 dlib 的安装时间可能会长一点.

  1. pip3 install cmake
  2. pip3 install face_recognition
  3. pip3 install numpy
  4. pip3 install dlib
  5. pip3 install opencv-python

依赖安装方式二:

  1. 安装 cmake , brew install cmake
  2. 安装 dlib , How to install dlib from source on macOS or Ubuntu
  3. 安装 face_recognition , pip3 install face_recognition
  4. 安装 opencv , pip3 install opencv-python
  5. 安装 numpy , pip3 install numpy

运行案例

运行之后出现弹窗给与摄像头权限,然后准备一张拜登/奥巴马图片对准摄像头即可完成人脸识别

  1. git clone https://github.com/ageitgey/face_recognition.git
  2. cd face_recognition/examples/
  3. python3 facerec_from_webcam_faster.py

参考

A Beginners guide to Building your own Face Recognition System to creep out your Friends

Face Recognition 人脸识别

Can cv2. putText support Chinese output?python opencv