Update app.py
Browse files
app.py
CHANGED
@@ -389,12 +389,13 @@ def check_liveness(frame):
|
|
389 |
if y2 >= image.height:
|
390 |
y2 = image.height - 1
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
|
|
398 |
|
399 |
if angles is not None:
|
400 |
yaw = angles[0]
|
|
|
389 |
if y2 >= image.height:
|
390 |
y2 = image.height - 1
|
391 |
|
392 |
+
if (x2 - x1) != 0 and (y2 - y1) != 0:
|
393 |
+
face_crop = image.crop((x1, y1, x2, y2))
|
394 |
+
face_image_ratio = face_crop.width / float(face_crop.height)
|
395 |
+
resized_w = int(face_image_ratio * 150)
|
396 |
+
resized_h = 150
|
397 |
+
|
398 |
+
face_crop = face_crop.resize((int(resized_w), int(resized_h)))
|
399 |
|
400 |
if angles is not None:
|
401 |
yaw = angles[0]
|