Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -179,6 +179,7 @@ def process_video(video_path, ref_img, trans, res, step, feather):
|
|
179 |
first_morphed = None
|
180 |
|
181 |
for i in range(total):
|
|
|
182 |
ret, frame = cap.read()
|
183 |
if not ret:
|
184 |
break
|
@@ -190,14 +191,14 @@ def process_video(video_path, ref_img, trans, res, step, feather):
|
|
190 |
x, y, bw, bh = box
|
191 |
|
192 |
# Morph using full-frame resized inputs (frame and masked ref)
|
193 |
-
frame_resized = cv2.resize(frame, (res, res))
|
194 |
alpha = float(np.clip((trans + 1) / 2, 0, 1))
|
195 |
morphed = morph_faces(frame_resized, ref_morph, alpha, res, step)
|
196 |
|
197 |
# Store first outputs with correct masking
|
198 |
if i == 0:
|
199 |
# face-fit crop of first frame
|
200 |
-
first_frame_central =
|
201 |
first_ref_central = ref_morph.copy()
|
202 |
first_morphed = morphed.copy()
|
203 |
|
|
|
179 |
first_morphed = None
|
180 |
|
181 |
for i in range(total):
|
182 |
+
print("frame : " + str(i))
|
183 |
ret, frame = cap.read()
|
184 |
if not ret:
|
185 |
break
|
|
|
191 |
x, y, bw, bh = box
|
192 |
|
193 |
# Morph using full-frame resized inputs (frame and masked ref)
|
194 |
+
frame_resized = cv2.resize(frame[y:y+bh, x:x+bw], (res, res))
|
195 |
alpha = float(np.clip((trans + 1) / 2, 0, 1))
|
196 |
morphed = morph_faces(frame_resized, ref_morph, alpha, res, step)
|
197 |
|
198 |
# Store first outputs with correct masking
|
199 |
if i == 0:
|
200 |
# face-fit crop of first frame
|
201 |
+
first_frame_central = frame_resized.copy
|
202 |
first_ref_central = ref_morph.copy()
|
203 |
first_morphed = morphed.copy()
|
204 |
|