利用face_recognition库裁取人脸

Posted ayew

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了利用face_recognition库裁取人脸相关的知识,希望对你有一定的参考价值。

 1 from PIL import Image
 2 import face_recognition
 3 
 4 # Load the jpg file into a numpy array
 5 image = face_recognition.load_image_file(".jpg")
 6 
 7 # Find all the faces in the image
 8 face_locations = face_recognition.face_locations(image)
 9 
10 print("I found {} face(s) in this photograph.".format(len(face_locations)))
11 
12 for face_location in face_locations:
13 
14     # Print the location of each face in this image
15     top, right, bottom, left = face_location
16     print("A face is located at pixel location Top: {}, Left: {}, Bottom: {}, Right: {}".format(top, left, bottom, right))
17 
18     # You can access the actual face itself like this:
19     face_image = image[top:bottom, left:right]
20     pil_image = Image.fromarray(face_image)
21     pil_image.show()

 

 

以上是关于利用face_recognition库裁取人脸的主要内容,如果未能解决你的问题,请参考以下文章

人脸识别----face_recognition安装与应用(附代码)

[深度学习] Python人脸识别库face_recognition使用教程

Github开源人脸识别项目face_recognition

如何让 face_recognition 获得正确的人脸号码?

人脸验证(图片/视频) tensorflowpytorch框架dlib库(face_recognition)和opencv库————附带详细步骤和代码,可实际运行

使用 yolov4 人脸检测和 face_recognition