Skip to content

Commit 99bd91c

Browse files
committed
Tweak demo to show multiple faces in one window instead of separate windows
1 parent 634db2e commit 99bd91c

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎examples/find_facial_features_in_picture.py‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@
22
import face_recognition
33

44
# Load the jpg file into a numpy array
5-
image = face_recognition.load_image_file("biden.jpg")
5+
image = face_recognition.load_image_file("two_people.jpg")
66

77
# Find all facial features in all the faces in the image
88
face_landmarks_list = face_recognition.face_landmarks(image)
99

1010
print("I found {} face(s) in this photograph.".format(len(face_landmarks_list)))
1111

12+
# Create a PIL imagedraw object so we can draw on the picture
13+
pil_image = Image.fromarray(image)
14+
d = ImageDraw.Draw(pil_image)
15+
1216
for face_landmarks in face_landmarks_list:
1317

1418
# Print the location of each facial feature in this image
1519
for facial_feature in face_landmarks.keys():
1620
print("The {} in this face has the following points: {}".format(facial_feature, face_landmarks[facial_feature]))
1721

1822
# Let's trace out each facial feature in the image with a line!
19-
pil_image = Image.fromarray(image)
20-
d = ImageDraw.Draw(pil_image)
21-
2223
for facial_feature in face_landmarks.keys():
2324
d.line(face_landmarks[facial_feature], width=5)
2425

25-
pil_image.show()
26+
# Show the picture
27+
pil_image.show()

0 commit comments

Comments
 (0)