Create camera model to simulate general pinhole camera.
(
scene: Gaussians3D,
intrinsics: torch.Tensor,
resolution_px: tuple[int, int],
lookat_mode: LookAtMode = "point",
)
| 201 | |
| 202 | |
| 203 | def create_camera_model( |
| 204 | scene: Gaussians3D, |
| 205 | intrinsics: torch.Tensor, |
| 206 | resolution_px: tuple[int, int], |
| 207 | lookat_mode: LookAtMode = "point", |
| 208 | ) -> PinholeCameraModel: |
| 209 | """Create camera model to simulate general pinhole camera.""" |
| 210 | screen_extrinsics = torch.eye(4) |
| 211 | screen_intrinsics = intrinsics.clone() |
| 212 | |
| 213 | image_width, image_height = resolution_px |
| 214 | screen_resolution_px = get_screen_resolution_px_from_input( |
| 215 | width=image_width, height=image_height |
| 216 | ) |
| 217 | |
| 218 | screen_intrinsics[0] *= screen_resolution_px[0] / image_width |
| 219 | screen_intrinsics[1] *= screen_resolution_px[1] / image_height |
| 220 | |
| 221 | camera_model = PinholeCameraModel( |
| 222 | scene, |
| 223 | screen_extrinsics=screen_extrinsics, |
| 224 | screen_intrinsics=screen_intrinsics, |
| 225 | screen_resolution_px=screen_resolution_px, |
| 226 | focus_depth_quantile=0.1, |
| 227 | min_depth_focus=2.0, |
| 228 | lookat_mode=lookat_mode, |
| 229 | ) |
| 230 | return camera_model |
| 231 | |
| 232 | |
| 233 | def create_camera_matrix( |
nothing calls this directly
no test coverage detected