wxDai's picture
init
6b1e9f7
raw
history blame contribute delete
540 Bytes
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)
return 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