Spaces:
Runtime error
Runtime error
File size: 490 Bytes
4d1ebf3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import cv2
import numpy as np
# resize frames
def resize_frames(frames, size=None):
"""
size: (w, h)
"""
if size is not None:
frames = [cv2.resize(f, size) for f in frames]
frames = np.stack(frames, 0)
return frames
# resize frames
def resize_masks(masks, size=None):
"""
size: (w, h)
"""
if size is not None:
masks = [np.expand_dims(cv2.resize(m, size), 2) for m in masks]
masks = np.stack(masks, 0)
return masks
|