Compute a static camera. Defaults from start frame pose if not given.
(c2w_poses: np.ndarray, start_frame: int,
eye: Optional[List[float]] = None,
lookat_pt: Optional[List[float]] = None,
fov_deg: float = 60.0)
| 459 | # --------------------------------------------------------------------------- |
| 460 | |
| 461 | def _static_camera(c2w_poses: np.ndarray, start_frame: int, |
| 462 | eye: Optional[List[float]] = None, |
| 463 | lookat_pt: Optional[List[float]] = None, |
| 464 | fov_deg: float = 60.0) -> Camera: |
| 465 | """Compute a static camera. Defaults from start frame pose if not given.""" |
| 466 | c2w = c2w_poses[start_frame] |
| 467 | cam_pos = c2w[:3, 3].astype(np.float32) |
| 468 | cam_fwd = c2w[:3, 2].astype(np.float32) |
| 469 | cam_fwd = cam_fwd / max(np.linalg.norm(cam_fwd), 1e-6) |
| 470 | cam_up = (-c2w[:3, 1]).astype(np.float32) |
| 471 | cam_up = cam_up / max(np.linalg.norm(cam_up), 1e-6) |
| 472 | |
| 473 | eye_pt = np.array(eye, dtype=np.float32) if eye else cam_pos |
| 474 | center_pt = np.array(lookat_pt, dtype=np.float32) if lookat_pt else cam_pos + cam_fwd |
| 475 | return Camera(eye_pt, center_pt, cam_up, fov_deg) |
| 476 | |
| 477 | |
| 478 | def make_static_path(c2w_poses: np.ndarray, start_frame: int, end_frame: int, |
no test coverage detected