Skip to content

Instantly share code, notes, and snippets.

@john-nash-rs
Created August 22, 2019 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save john-nash-rs/0c8fa7478dedc35436bebd2c13b096da to your computer and use it in GitHub Desktop.
Save john-nash-rs/0c8fa7478dedc35436bebd2c13b096da to your computer and use it in GitHub Desktop.
import PIL.Image
import PIL.ImageDraw
import face_recognition
image = face_recognition.load_image_file("IMG_20190720_160311.jpg")
face_locations = face_recognition.face_locations(image)
number_of_faces = len(face_locations)
pil_image = PIL.Image.fromarray(image)
for face_location in face_locations:
top, right, bottom, left = face_location
draw = PIL.ImageDraw.Draw(pil_image)
draw.rectangle([left,top, right, bottom],outline="red",width=5)
pil_image.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment