NihalGazi commited on
Commit
95a0ff0
·
verified ·
1 Parent(s): e6f4360

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -166,14 +166,14 @@ def morph_faces(img1, img2, alpha, dim, step):
166
  return (out*255).astype(np.uint8)
167
 
168
 
169
- def process_video(video_path, ref_img, trans, res, step, feather):
170
  cap = cv2.VideoCapture(video_path)
171
  fps = cap.get(cv2.CAP_PROP_FPS) or 24
172
  total = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
173
 
174
  # Prepare masked reference
175
  ref_bgr = cv2.cvtColor(ref_img, cv2.COLOR_RGB2BGR)
176
- mask_ref, ref_box = get_face_mask_box(ref_bgr, feather)
177
  if mask_ref is None:
178
  return None, None, None, None
179
  x_r, y_r, w_r, h_r = ref_box
@@ -196,7 +196,7 @@ def process_video(video_path, ref_img, trans, res, step, feather):
196
  for i in range(total):
197
  ret, frame = cap.read()
198
  if not ret: break
199
- mask_roi, box = get_face_mask_box(frame, feather)
200
  if mask_roi is None:
201
  out_vid.write(frame)
202
  continue
 
166
  return (out*255).astype(np.uint8)
167
 
168
 
169
+ def process_video(video_path, ref_img, trans, res, step, feather, padding):
170
  cap = cv2.VideoCapture(video_path)
171
  fps = cap.get(cv2.CAP_PROP_FPS) or 24
172
  total = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
173
 
174
  # Prepare masked reference
175
  ref_bgr = cv2.cvtColor(ref_img, cv2.COLOR_RGB2BGR)
176
+ mask_ref, ref_box = get_face_mask_box(ref_bgr, feather, padding)
177
  if mask_ref is None:
178
  return None, None, None, None
179
  x_r, y_r, w_r, h_r = ref_box
 
196
  for i in range(total):
197
  ret, frame = cap.read()
198
  if not ret: break
199
+ mask_roi, box = get_face_mask_box(frame, feather, padding)
200
  if mask_roi is None:
201
  out_vid.write(frame)
202
  continue