| 665 | ) |
| 666 | |
| 667 | def add_camera(self, step): |
| 668 | cam = self.cam_dict |
| 669 | focal = cam["focal"][step] |
| 670 | pp = cam["pp"][step] |
| 671 | R = cam["R"][step] |
| 672 | t = cam["t"][step] |
| 673 | |
| 674 | q = tf.SO3.from_matrix(R).wxyz |
| 675 | fov = 2 * np.arctan(pp[0] / focal) |
| 676 | aspect = pp[0] / pp[1] |
| 677 | self.traj_list.append((q, t)) |
| 678 | self.cam_handles.append( |
| 679 | self.server.add_camera_frustum( |
| 680 | name=f"/frames/{step}/camera", |
| 681 | fov=fov, |
| 682 | aspect=aspect, |
| 683 | wxyz=q, |
| 684 | position=t, |
| 685 | scale=0.1, |
| 686 | color=(50, 205, 50), |
| 687 | ) |
| 688 | ) |
| 689 | |
| 690 | def animate(self): |
| 691 | with self.server.add_gui_folder("Playback"): |