from PIL import Image, ImageDraw import face_recognition import math image = face_recognition.load_image_file("cai.jpg") face_landmarks_list = face_recognition.face_landmarks(image) pil_image = Image.fromarray(image)
for face_landmarks in face_landmarks_list: d = ImageDraw.Draw(pil_image) # 画一下人脸识别效果 for facial_feature in face_landmarks.keys(): d.line(face_landmarks[facial_feature], width=5)