不罗嗦先上代码:
import face_recognition
import cv2
import numpy as np
# 调用笔记本 人脸识别 可配置照片
# This is a demo of running face recognition on live video from your webcam. It's a little more complicated than the
# other example, but it includes some basic performance tweaks to make things run a lot faster:
# 1. Process each video frame at 1/4 resolution (though still display it at full resolution)
# 2. Only detect faces in every other frame of video.
# PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam.
# OpenCV is *not* required to use the face_recognition library. It's only required if you want to run this
# specific demo. If you have trouble installing it, try any of the other demos that don't require it instead.
# Get a reference to webcam #0 (the default one)
video_capture = cv2.VideoCapture(0)
# Load a sample picture and learn how to recognize it.
# 刘振达
zhend

本文介绍了如何在Python环境中,通过face_recognition库进行人脸识别。首先确保使用Python37,然后依次安装cmake、boost、opencv、dlib(针对Python37提供了whl文件的下载链接),最后安装face_recognition库。只需替换代码中图片路径,即可完成人脸识别认证。
最低0.47元/天 解锁文章
2945





