nghorbani / amass

Data preparation and loader for AMASS
https://amass.is.tue.mpg.de/
Other
621 stars 80 forks source link

Camera movements with the rendering tool #43

Open azadis opened 1 year ago

azadis commented 1 year ago

Hi, I am trying to visualize an amass example using its body_pose, root_orient and translation parameters. It looks like the video that I get from the rendering tool has some camera movements. It is not just the body that is moving in the space, but also the camera. I feed all these three parameters as items in the body_params dictionary. Is that normal to see camera movements here? `

def render_smpl_params(bm, body_parms, trans=None, rot_body=None, bg_color='white', body_color='neutral'):
  '''
  :param bm: pytorch body model with batch_size 1
  :param pose_body: Nx21x3
  :param trans: Nx3
  :param betas: Nxnum_betas
  :return: N x 400 x 400 x 3
  '''

  imw, imh = 400, 400
  base_trans = [0, 0.5, 3.0]

  mv = MeshViewer(width=imw, height=imh, use_offscreen=True)
  mv.set_cam_trans(base_trans)
  mv.set_background_color(color=bg_color)
  faces = c2c(bm.f)

  v = c2c(bm(**body_parms).v)
  T, num_verts = v.shape[:-1]

  images = []
  for fIdx in range(T):
      verts = v[fIdx]
      if rot_body is not None:
          verts = rotateXYZ(verts, rot_body)
      color_type = body_color

      color = np.ones_like(verts) * np.array(colors[color_type])[None, :]

      mesh = trimesh.base.Trimesh(verts, faces, vertex_colors=num_verts*colors['grey'])
      mv.set_meshes([mesh], 'static')

      rendered = mv.render()
      images.append(rendered)
return np.array(images).reshape(T, imw, imh, 3)`