利用face_recognition库裁取人脸

利用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库裁取人脸

 

上一篇:DBeaver入门


下一篇:发现了一个非常棒的pyqt5的例子集