| 165 | |
| 166 | @dataclasses.dataclass |
| 167 | class CameraState(object): |
| 168 | fov: float |
| 169 | aspect: float |
| 170 | c2w: np.ndarray |
| 171 | |
| 172 | def get_K(self, img_wh): |
| 173 | W, H = img_wh |
| 174 | focal_length = H / 2.0 / np.tan(self.fov / 2.0) |
| 175 | K = np.array( |
| 176 | [ |
| 177 | [focal_length, 0.0, W / 2.0], |
| 178 | [0.0, focal_length, H / 2.0], |
| 179 | [0.0, 0.0, 1.0], |
| 180 | ] |
| 181 | ) |
| 182 | return K |
| 183 | |
| 184 | |
| 185 | def get_vertical_colorbar(h, vmin, vmax, cmap_name="jet", label=None, cbar_precision=2): |