sczhou / ProPainter

[ICCV 2023] ProPainter: Improving Propagation and Transformer for Video Inpainting
https://shangchenzhou.com/projects/ProPainter/
Other
5.45k stars 645 forks source link

Using masks in video format for video completion #75

Open Nd-sole opened 6 months ago

Nd-sole commented 6 months ago

Hi,

Can we use video mask corresponding to each frame instead of image mask for video completion?

marsatgithub commented 4 months ago

def read_mask(mpath, length, size, flow_mask_dilates=8, mask_dilates=5,resize_ratio=1): masks_img = [] masks_dilated = [] flow_masks = []

if mpath.endswith(('jpg', 'jpeg', 'png', 'JPG', 'JPEG', 'PNG')): # input single img path
   masks_img = [Image.open(mpath)]
elif mpath.endswith(('mp4')):
    #把mp4抽帧
    frames, fps, size, video_name = read_frame_from_videos(mpath)
    frames ,size, out_size = resize_frames(frames,  (int(resize_ratio * size[0]), int(resize_ratio * size[1])))
    masks_img=frames