MCPcopy Create free account
hub / github.com/Francis-Rings/FlashPortrait / get_relative_pose

Function get_relative_pose

wan/data/utils.py:227–242  ·  view source on GitHub ↗

Copied from https://github.com/hehao13/CameraCtrl/blob/main/inference.py

(cam_params)

Source from the content-addressed store, hash-verified

225 return torch.meshgrid(*args, indexing='ij')
226
227def 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
244def ray_condition(K, c2w, H, W, device):
245 """Copied from https://github.com/hehao13/CameraCtrl/blob/main/inference.py

Callers 2

process_pose_fileFunction · 0.85
process_pose_paramsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected