KingNish commited on
Commit
10b6ea4
1 Parent(s): 5d54853

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -43,13 +43,9 @@ def fn(vid, fps, color):
43
  processed_frames_changed_bg = []
44
  for frame in frames:
45
  pil_image = Image.fromarray(frame)
46
- processed_image, mask = process(pil_image, color) # Get both processed image and mask
47
- processed_frames_no_bg.append(np.array(processed_image)) # Save no-background frame
48
-
49
- # Compose with background for changed background video
50
- background = Image.new("RGBA", pil_image.size, color + str((255,)))
51
- composed_image = Image.composite(pil_image, background, mask)
52
- processed_frames_changed_bg.append(np.array(composed_image))
53
 
54
  # Create a new video from the processed frames
55
  processed_video = mp.ImageSequenceClip(processed_frames_changed_bg, fps=fps)
 
43
  processed_frames_changed_bg = []
44
  for frame in frames:
45
  pil_image = Image.fromarray(frame)
46
+ processed_image, mask = process(pil_image, color)
47
+ processed_frames_no_bg.append(np.array(mask))
48
+ processed_frames_changed_bg.append(np.array(processed_image))
 
 
 
 
49
 
50
  # Create a new video from the processed frames
51
  processed_video = mp.ImageSequenceClip(processed_frames_changed_bg, fps=fps)