Load one of the default cameras for the scene.
(
model_path,
default_camera_index=0,
center_view_world_space=None,
observant_coordinates=None,
show_hint=False,
init_azimuthm=None,
init_elevation=None,
init_radius=None,
move_camera=False,
current_frame=0,
delta_a=0,
delta_e=0,
delta_r=0,
)
| 91 | |
| 92 | |
| 93 | def get_camera_view( |
| 94 | model_path, |
| 95 | default_camera_index=0, |
| 96 | center_view_world_space=None, |
| 97 | observant_coordinates=None, |
| 98 | show_hint=False, |
| 99 | init_azimuthm=None, |
| 100 | init_elevation=None, |
| 101 | init_radius=None, |
| 102 | move_camera=False, |
| 103 | current_frame=0, |
| 104 | delta_a=0, |
| 105 | delta_e=0, |
| 106 | delta_r=0, |
| 107 | ): |
| 108 | """Load one of the default cameras for the scene.""" |
| 109 | cam_path = os.path.join(model_path, "cameras.json") |
| 110 | with open(cam_path) as f: |
| 111 | data = json.load(f) |
| 112 | |
| 113 | if show_hint: |
| 114 | if default_camera_index < 0: |
| 115 | default_camera_index = 0 |
| 116 | r, a, e = get_current_radius_azimuth_and_elevation( |
| 117 | data[default_camera_index]["position"], |
| 118 | center_view_world_space, |
| 119 | observant_coordinates, |
| 120 | ) |
| 121 | print("Default camera ", default_camera_index, " has") |
| 122 | print("azimuth: ", a) |
| 123 | print("elevation: ", e) |
| 124 | print("radius: ", r) |
| 125 | print("Now exit program and set your own input!") |
| 126 | exit() |
| 127 | |
| 128 | if default_camera_index > -1: |
| 129 | raw_camera = data[default_camera_index] |
| 130 | |
| 131 | else: |
| 132 | raw_camera = data[0] # get data to be modified |
| 133 | |
| 134 | assert init_azimuthm is not None |
| 135 | assert init_elevation is not None |
| 136 | assert init_radius is not None |
| 137 | |
| 138 | if move_camera: |
| 139 | assert delta_a is not None |
| 140 | assert delta_e is not None |
| 141 | assert delta_r is not None |
| 142 | position, R = get_camera_position_and_rotation( |
| 143 | init_azimuthm + current_frame * delta_a, |
| 144 | init_elevation + current_frame * delta_e, |
| 145 | init_radius + current_frame * delta_r, |
| 146 | center_view_world_space, |
| 147 | observant_coordinates, |
| 148 | ) |
| 149 | else: |
| 150 | position, R = get_camera_position_and_rotation( |
no test coverage detected