(camera_dict, camera_args=None, num_frames=16)
| 96 | return np.concatenate([RT_0, RT_1], axis=0) |
| 97 | |
| 98 | def process_camera(camera_dict, camera_args=None, num_frames=16): |
| 99 | speed = camera_dict['speed'] |
| 100 | motion_list = camera_dict['motion'] |
| 101 | mode = camera_dict['mode'] |
| 102 | |
| 103 | if mode == 'Customized Mode 3: RAW Camera Poses': |
| 104 | print(camera_args) |
| 105 | RT = camera_args.strip().split() |
| 106 | assert(len(RT) == num_frames*12), "The number of camera poses should be equal to the number of frames" |
| 107 | RT = [float(x) for x in RT] |
| 108 | RT = np.array(RT).reshape(-1, 3, 4) |
| 109 | RT[:, :, -1] = RT[:, :, -1] * np.array([1.5, 1, 1.3]) * speed |
| 110 | return RT |
| 111 | |
| 112 | # "First A then B", "Both A and B", "Custom" |
| 113 | if camera_dict['complex'] is not None: |
| 114 | with open(COMPLEX_CAMERA[camera_dict['complex']]) as f: |
| 115 | RT = json.load(f) # [16, 12] |
| 116 | RT = np.array(RT).reshape(-1, 3, 4) |
| 117 | print(RT.shape) |
| 118 | return RT |
| 119 | |
| 120 | |
| 121 | print(len(motion_list)) |
| 122 | if len(motion_list) == 0: |
| 123 | angle = np.array([0,0,0]) |
| 124 | T = np.array([0,0,0]) |
| 125 | RT = get_camera_motion(angle, T, speed, 16) |
| 126 | |
| 127 | |
| 128 | elif len(motion_list) == 1: |
| 129 | angle = np.array(CAMERA[motion_list[0]]["angle"]) |
| 130 | T = np.array(CAMERA[motion_list[0]]["T"]) |
| 131 | print(angle, T) |
| 132 | RT = get_camera_motion(angle, T, speed, 16) |
| 133 | |
| 134 | |
| 135 | |
| 136 | elif len(motion_list) == 2: |
| 137 | if mode == "Customized Mode 1: First A then B": |
| 138 | angle = np.array(CAMERA[motion_list[0]]["angle"]) |
| 139 | T = np.array(CAMERA[motion_list[0]]["T"]) |
| 140 | RT_0 = get_camera_motion(angle, T, speed, 8) |
| 141 | |
| 142 | angle = np.array(CAMERA[motion_list[1]]["angle"]) |
| 143 | T = np.array(CAMERA[motion_list[1]]["T"]) |
| 144 | RT_1 = get_camera_motion(angle, T, speed, 8) |
| 145 | |
| 146 | RT = combine_camera_motion(RT_0, RT_1) |
| 147 | |
| 148 | elif mode == "Customized Mode 2: Both A and B": |
| 149 | angle = np.array(CAMERA[motion_list[0]]["angle"]) + np.array(CAMERA[motion_list[1]]["angle"]) |
| 150 | T = np.array(CAMERA[motion_list[0]]["T"]) + np.array(CAMERA[motion_list[1]]["T"]) |
| 151 | RT = get_camera_motion(angle, T, speed, 16) |
| 152 | |
| 153 | |
| 154 | # return RT.reshape(-1, 12) |
| 155 | return RT |
no test coverage detected