1
0
Fork 0
mirror of https://github.com/deepfakes/faceswap synced 2025-06-08 20:13:52 -04:00
faceswap/lib/faces_detect.py
Hidde Jansen 7f7f110933
Command line options for convert.py (#13)
* Rewrite extract.py, make code re-usable for conversion too.

* Add convert.py, adding command line options
2017-12-22 01:52:47 +01:00

13 lines
434 B
Python

import face_recognition
from .DetectedFace import DetectedFace
def crop_faces(frame):
face_locations = face_recognition.face_locations(frame)
#face_encodings = face_recognition.face_encodings(frame, face_locations)
for (top, right, bottom, left) in face_locations:
x = left
y = top
w = right - left
h = bottom - top
yield DetectedFace(frame[y: y + h, x: x + w], x, w, y, h, None)