Spanicin commited on
Commit
dfba074
1 Parent(s): 5aeb522

Update src/utils/paste_pic.py

Browse files
Files changed (1) hide show
  1. src/utils/paste_pic.py +4 -9
src/utils/paste_pic.py CHANGED
@@ -54,16 +54,11 @@ def paste_pic(video_path, pic_path, crop_info, new_audio_path, full_video_path):
54
  out_tmp = cv2.VideoWriter(tmp_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (frame_w, frame_h))
55
  for crop_frame in tqdm(crop_frames, 'seamlessClone:'):
56
  p = cv2.resize(crop_frame.astype(np.uint8), (crx-clx, cry - cly))
57
- roi = full_img[cly:cry, clx:crx]
58
- alpha = 0.5
59
- blended = cv2.addWeighted(p, alpha, roi, 1 - alpha, 0)
60
- full_img[cly:cry, clx:crx] = blended
61
- out_tmp.write(full_img)
62
 
63
- # mask = 255*np.ones(p.shape, p.dtype)
64
- # location = ((ox1+ox2) // 2, (oy1+oy2) // 2)
65
- # gen_img = cv2.seamlessClone(p, full_img, mask, location, cv2.NORMAL_CLONE)
66
- # out_tmp.write(gen_img)
67
 
68
  out_tmp.release()
69
 
 
54
  out_tmp = cv2.VideoWriter(tmp_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (frame_w, frame_h))
55
  for crop_frame in tqdm(crop_frames, 'seamlessClone:'):
56
  p = cv2.resize(crop_frame.astype(np.uint8), (crx-clx, cry - cly))
 
 
 
 
 
57
 
58
+ mask = 255*np.ones(p.shape, p.dtype)
59
+ location = ((ox1+ox2) // 2, (oy1+oy2) // 2)
60
+ gen_img = cv2.seamlessClone(p, full_img, mask, location, cv2.NORMAL_CLONE)
61
+ out_tmp.write(gen_img)
62
 
63
  out_tmp.release()
64