mirror of
https://github.com/deepfakes/faceswap
synced 2025-06-08 03:26:47 -04:00
* Image rotator for extract and convert ready for testing
* Revert "Image rotator for extract and convert ready for testing"
This reverts commit bbeb19ef26
.
Error in extract code
* add image rotation support to detect more faces
* Update convert.py
Amended to do a single check for for rotation rather than checking twice. Performance gain is likely to be marginal to non-existent, but can't hurt.
* Update convert.py
remove type
* cli.py: Only output message on verbose. Convert.py: Only check for rotation amount once
* Changed command line flag to take arguments to ease future development
* Realigning for upstream/Master
* Minor fix
20 lines
No EOL
753 B
Python
20 lines
No EOL
753 B
Python
from lib import FaceLandmarksExtractor
|
|
|
|
def detect_faces(frame, rotation=0, model="hog"):
|
|
fd = FaceLandmarksExtractor.extract (frame, True if model == "cnn" else False )
|
|
for face in fd:
|
|
x, y, right, bottom, landmarks = face[0][0], face[0][1], face[0][2], face[0][3], face[1]
|
|
yield DetectedFace(frame[y: bottom, x: right], rotation, x, right - x, y, bottom - y, landmarksXY=landmarks)
|
|
|
|
class DetectedFace(object):
|
|
def __init__(self, image=None, r=None, x=None, w=None, y=None, h=None, landmarksXY=None):
|
|
self.image = image
|
|
self.r = r
|
|
self.x = x
|
|
self.w = w
|
|
self.y = y
|
|
self.h = h
|
|
self.landmarksXY = landmarksXY
|
|
|
|
def landmarksAsXY(self):
|
|
return self.landmarksXY |