Compute the maximum offset for camera along X/Y/Z axis.
(
scene: Gaussians3D,
params: TrajectoryParams,
resolution_px: tuple[int, int],
f_px: float,
)
| 51 | |
| 52 | |
| 53 | def compute_max_offset( |
| 54 | scene: Gaussians3D, |
| 55 | params: TrajectoryParams, |
| 56 | resolution_px: tuple[int, int], |
| 57 | f_px: float, |
| 58 | ) -> np.ndarray: |
| 59 | """Compute the maximum offset for camera along X/Y/Z axis.""" |
| 60 | scene_points = scene.mean_vectors |
| 61 | extrinsics = torch.eye(4).to(scene_points.device) |
| 62 | min_depth, _, _ = _compute_depth_quantiles(scene_points, extrinsics) |
| 63 | |
| 64 | r_px = resolution_px |
| 65 | diagonal = np.sqrt((r_px[0] / f_px) ** 2 + (r_px[1] / f_px) ** 2) |
| 66 | max_lateral_offset_m = params.max_disparity * diagonal * min_depth |
| 67 | |
| 68 | max_medial_offset_m = params.max_zoom * min_depth |
| 69 | max_offset_xyz_m = np.array([max_lateral_offset_m, max_lateral_offset_m, max_medial_offset_m]) |
| 70 | |
| 71 | return max_offset_xyz_m |
| 72 | |
| 73 | |
| 74 | def create_eye_trajectory( |
no test coverage detected