Get the relative rotations of the virtual cameras w.r.t. the panorama.
(
num_steps_yaw: int, pitches_deg: Sequence[float]
)
| 140 | |
| 141 | |
| 142 | def get_virtual_rotations( |
| 143 | num_steps_yaw: int, pitches_deg: Sequence[float] |
| 144 | ) -> Sequence[npt.NDArray[np.floating]]: |
| 145 | """Get the relative rotations of the virtual cameras w.r.t. the panorama.""" |
| 146 | # Assuming that the panos are approximately upright. |
| 147 | cams_from_pano_r = [] |
| 148 | yaws = np.linspace(0, 360, num_steps_yaw, endpoint=False) |
| 149 | for pitch_deg in pitches_deg: |
| 150 | yaw_offset = (360 / num_steps_yaw / 2) if pitch_deg > 0 else 0 |
| 151 | for yaw_deg in yaws + yaw_offset: |
| 152 | cam_from_pano_r = Rotation.from_euler( |
| 153 | "XY", [-pitch_deg, -yaw_deg], degrees=True |
| 154 | ).as_matrix() |
| 155 | cams_from_pano_r.append(cam_from_pano_r) |
| 156 | return cams_from_pano_r |
| 157 | |
| 158 | |
| 159 | def create_pano_rig_config( |