Spaces:
Sleeping
Sleeping
roychao19477
commited on
Commit
·
79fa1e3
1
Parent(s):
5327709
Update module
Browse files
app.py
CHANGED
@@ -167,15 +167,12 @@ def extract_faces(video_file):
|
|
167 |
if face_crop.size != 0:
|
168 |
#resized = cv2.resize(face_crop, (224, 224))
|
169 |
#frames.append(resized)
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
if center_crop.shape[0] == 224 and center_crop.shape[1] == 224:
|
178 |
-
frames.append(center_crop)
|
179 |
break # only one face per frame
|
180 |
|
181 |
cap.release()
|
|
|
167 |
if face_crop.size != 0:
|
168 |
#resized = cv2.resize(face_crop, (224, 224))
|
169 |
#frames.append(resized)
|
170 |
+
from PIL import Image, ImageOps
|
171 |
+
|
172 |
+
face_crop = Image.fromarray(face_crop)
|
173 |
+
resized = ImageOps.pad(face_crop, (224, 224), color=0)
|
174 |
+
resized = np.array(resized)
|
175 |
+
frames.append(resized)
|
|
|
|
|
|
|
176 |
break # only one face per frame
|
177 |
|
178 |
cap.release()
|