BladeSzaSza commited on
Commit
9347cf3
·
verified ·
1 Parent(s): 1ed20c4

fix: resample world_rotations with num_frames

Browse files
Files changed (1) hide show
  1. vid2rig/retarget/resample.py +8 -1
vid2rig/retarget/resample.py CHANGED
@@ -17,6 +17,13 @@ def resample(clip: MotionClip, target_fps: float) -> MotionClip:
17
  new_rots[:, j] = slerp_series(clip.local_rotations[:, j], src_t, dst_t)
18
  new_transl = np.stack([np.interp(dst_t, src_t, clip.root_translation[:, c]) for c in range(3)], axis=1)
19
 
 
 
 
 
 
 
20
  return replace(clip, fps=target_fps, num_frames=n_out,
21
  local_rotations=new_rots, root_translation=new_transl,
22
- root_rotation=new_rots[:, 0].copy())
 
 
17
  new_rots[:, j] = slerp_series(clip.local_rotations[:, j], src_t, dst_t)
18
  new_transl = np.stack([np.interp(dst_t, src_t, clip.root_translation[:, c]) for c in range(3)], axis=1)
19
 
20
+ new_world = None
21
+ if clip.world_rotations is not None: # MHR path: resample world rots too
22
+ new_world = np.empty((n_out, J, 4))
23
+ for j in range(J):
24
+ new_world[:, j] = slerp_series(clip.world_rotations[:, j], src_t, dst_t)
25
+
26
  return replace(clip, fps=target_fps, num_frames=n_out,
27
  local_rotations=new_rots, root_translation=new_transl,
28
+ root_rotation=(new_world if new_world is not None else new_rots)[:, 0].copy(),
29
+ world_rotations=new_world)