MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / save_pose

Function save_pose

train.py:46–60  ·  view source on GitHub ↗
(path, quat_pose, train_cams, llffhold=2)

Source from the content-addressed store, hash-verified

44
45
46def save_pose(path, quat_pose, train_cams, llffhold=2):
47 # Get camera IDs and convert quaternion poses to camera matrices
48 camera_ids = [cam.colmap_id for cam in train_cams]
49 world_to_camera = [get_camera_from_tensor(quat) for quat in quat_pose]
50
51 # Reorder poses according to colmap IDs
52 colmap_poses = []
53 for i in range(len(camera_ids)):
54 idx = camera_ids.index(i + 1) # Find position of camera i+1
55 pose = world_to_camera[idx]
56 colmap_poses.append(pose)
57
58 # Convert to numpy array and save
59 colmap_poses = torch.stack(colmap_poses).detach().cpu().numpy()
60 np.save(path, colmap_poses)
61
62
63def load_and_prepare_confidence(confidence_path, device='cuda', scale=(0.1, 1.0)):

Callers 1

trainingFunction · 0.85

Calls 2

get_camera_from_tensorFunction · 0.90
saveMethod · 0.80

Tested by

no test coverage detected