Copied from https://github.com/hehao13/CameraCtrl/blob/main/inference.py
(cam_params)
| 225 | return torch.meshgrid(*args, indexing='ij') |
| 226 | |
| 227 | def get_relative_pose(cam_params): |
| 228 | """Copied from https://github.com/hehao13/CameraCtrl/blob/main/inference.py |
| 229 | """ |
| 230 | abs_w2cs = [cam_param.w2c_mat for cam_param in cam_params] |
| 231 | abs_c2ws = [cam_param.c2w_mat for cam_param in cam_params] |
| 232 | cam_to_origin = 0 |
| 233 | target_cam_c2w = np.array([ |
| 234 | [1, 0, 0, 0], |
| 235 | [0, 1, 0, -cam_to_origin], |
| 236 | [0, 0, 1, 0], |
| 237 | [0, 0, 0, 1] |
| 238 | ]) |
| 239 | abs2rel = target_cam_c2w @ abs_w2cs[0] |
| 240 | ret_poses = [target_cam_c2w, ] + [abs2rel @ abs_c2w for abs_c2w in abs_c2ws[1:]] |
| 241 | ret_poses = np.array(ret_poses, dtype=np.float32) |
| 242 | return ret_poses |
| 243 | |
| 244 | def ray_condition(K, c2w, H, W, device): |
| 245 | """Copied from https://github.com/hehao13/CameraCtrl/blob/main/inference.py |
no outgoing calls
no test coverage detected