Spaces:
Running
on
Zero
Running
on
Zero
roychao19477
commited on
Commit
·
9e0d895
1
Parent(s):
6ab878e
Update module
Browse files
app.py
CHANGED
@@ -165,17 +165,17 @@ def extract_faces(video_file):
|
|
165 |
y2 = int(min(max(0, y2 + shift_down), h))
|
166 |
face_crop = frame[y1:y2, x1:x2]
|
167 |
if face_crop.size != 0:
|
168 |
-
|
169 |
-
#frames.append(resized)
|
170 |
-
|
171 |
-
h_crop, w_crop = face_crop.shape[:2]
|
172 |
-
side = min(h_crop, w_crop)
|
173 |
-
start_y = (h_crop - side) // 2
|
174 |
-
start_x = (w_crop - side) // 2
|
175 |
-
square_crop = face_crop[start_y:start_y+side, start_x:start_x+side]
|
176 |
-
resized = cv2.resize(square_crop, (224, 224))
|
177 |
frames.append(resized)
|
178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
break # only one face per frame
|
180 |
|
181 |
cap.release()
|
|
|
165 |
y2 = int(min(max(0, y2 + shift_down), h))
|
166 |
face_crop = frame[y1:y2, x1:x2]
|
167 |
if face_crop.size != 0:
|
168 |
+
resized = cv2.resize(face_crop, (224, 224))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
frames.append(resized)
|
170 |
|
171 |
+
#h_crop, w_crop = face_crop.shape[:2]
|
172 |
+
#side = min(h_crop, w_crop)
|
173 |
+
#start_y = (h_crop - side) // 2
|
174 |
+
#start_x = (w_crop - side) // 2
|
175 |
+
#square_crop = face_crop[start_y:start_y+side, start_x:start_x+side]
|
176 |
+
#resized = cv2.resize(square_crop, (224, 224))
|
177 |
+
#frames.append(resized)
|
178 |
+
|
179 |
break # only one face per frame
|
180 |
|
181 |
cap.release()
|