medusa.render.video#

A module with functionality to easily render a 4D mesh to a video using the VideoRender class.

Module Contents#

class medusa.render.video.VideoRenderer(shading='flat', lights=None, background=(0, 0, 0), loglevel='INFO')[source]#

Renders a 4D mesh to a video.

Parameters:
  • shading (str) – Type of shading (‘flat’, ‘smooth’, or ‘wireframe’; latter only when using ‘pyrender’)

  • lights (None, str, or pytorch3d Lights class) – Lights to use in rendering; if None, a default PointLight will be used

  • background (str, Path, VideoLoader, tuple) – Either a path to a video to be used as a background (or an initialized VideoLoader) or a 3-tuple of RGB values (between 0 and 255) to use as uniform color background; default is a uniform black background

  • loglevel (str) – Logging level (e.g., “INFO”, “DEBUG”, etc.)

render(f_out, data4d, overlay=None, **kwargs)[source]#

Renders the sequence of 3D meshes from a Data4D object as a video.

Parameters:
  • f_out (str) – Filename of output

  • data4d (Data4D) – A Data4D object

  • overlay (torch.tensor, TextureVertex) – Optional overlay to render on top of rendered mesh

  • video (str) – Path to video, in order to render face on top of original video frames

  • **kwargs – Keyword arguments, which may include “viewport”, “device”, “cam_mat”, “fps”, and “n_frames”. If not specified, these will be inferred from the supplied Data4D object.