Spaces:
Sleeping
Sleeping
File size: 518 Bytes
4409449 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import numpy as np
def get_frameidx(*, mode, nframes, exact_frame, frames_to_keep):
if mode == "sequence":
frameidx = np.linspace(0, nframes - 1, frames_to_keep)
frameidx = np.round(frameidx).astype(int)
frameidx = list(frameidx)
elif mode == "frame":
index_frame = int(exact_frame*nframes)
frameidx = [index_frame]
elif mode == "video":
frameidx = range(0, nframes)
else:
raise ValueError(f"Not support {mode} render mode")
return frameidx
|