Doron Adler
commited on
Commit
β’
dde6ed2
1
Parent(s):
549320b
Exif transform
Browse files- face_detection.py +6 -6
face_detection.py
CHANGED
@@ -14,6 +14,11 @@ detector = dlib.get_frontal_face_detector()
|
|
14 |
|
15 |
|
16 |
def align(image_in, face_index=0, output_size=256):
|
|
|
|
|
|
|
|
|
|
|
17 |
landmarks = list(get_landmarks(image_in))
|
18 |
n_faces = len(landmarks)
|
19 |
face_index = min(n_faces-1, face_index)
|
@@ -85,12 +90,7 @@ def image_align(src_img, face_landmarks, output_size=512, transform_size=2048, e
|
|
85 |
c = eye_avg + eye_to_mouth * em_scale
|
86 |
quad = np.stack([c - x - y, c - x + y, c + x + y, c + x - y])
|
87 |
quad_orig = quad.copy()
|
88 |
-
qsize = np.hypot(*x) * 2
|
89 |
-
|
90 |
-
try:
|
91 |
-
src_img = ImageOps.exif_transpose(src_img)
|
92 |
-
except:
|
93 |
-
print("exif problem, not rotating")
|
94 |
|
95 |
img = src_img.convert('RGBA').convert('RGB')
|
96 |
|
|
|
14 |
|
15 |
|
16 |
def align(image_in, face_index=0, output_size=256):
|
17 |
+
try:
|
18 |
+
image_in = ImageOps.exif_transpose(image_in)
|
19 |
+
except:
|
20 |
+
print("exif problem, not rotating")
|
21 |
+
|
22 |
landmarks = list(get_landmarks(image_in))
|
23 |
n_faces = len(landmarks)
|
24 |
face_index = min(n_faces-1, face_index)
|
|
|
90 |
c = eye_avg + eye_to_mouth * em_scale
|
91 |
quad = np.stack([c - x - y, c - x + y, c + x + y, c + x - y])
|
92 |
quad_orig = quad.copy()
|
93 |
+
qsize = np.hypot(*x) * 2
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
img = src_img.convert('RGBA').convert('RGB')
|
96 |
|