Compute disparity quantiles for scene and extrinsics id.
(
points: torch.Tensor,
extrinsics: torch.Tensor,
q_near: float = 0.001,
q_focus: float = 0.1,
q_far: float = 0.999,
)
| 366 | |
| 367 | |
| 368 | def _compute_depth_quantiles( |
| 369 | points: torch.Tensor, |
| 370 | extrinsics: torch.Tensor, |
| 371 | q_near: float = 0.001, |
| 372 | q_focus: float = 0.1, |
| 373 | q_far: float = 0.999, |
| 374 | ) -> FocusRange: |
| 375 | """Compute disparity quantiles for scene and extrinsics id.""" |
| 376 | points_local = points @ extrinsics[:3, :3].T + extrinsics[:3, 3] |
| 377 | depth_values = points_local[..., 2].flatten() |
| 378 | depth_values = depth_values[depth_values > 0] |
| 379 | q_values = torch.tensor([q_near, q_focus, q_far]) |
| 380 | depth_quantiles_pt = torch.quantile(depth_values.cpu(), q_values) |
| 381 | depth_quantiles = FocusRange( |
| 382 | min=float(depth_quantiles_pt[0]), |
| 383 | focus=float(depth_quantiles_pt[1]), |
| 384 | max=float(depth_quantiles_pt[2]), |
| 385 | ) |
| 386 | return depth_quantiles |
no test coverage detected