MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / load_sintel_traj

Function load_sintel_traj

eval_code/recons/relpose/evo_utils.py:136–165  ·  view source on GitHub ↗
(gt_file)

Source from the content-addressed store, hash-verified

134
135
136def load_sintel_traj(gt_file): # './data/sintel/training/camdata_left/alley_2'
137 # Refer to ParticleSfM
138 gt_pose_lists = sorted(os.listdir(gt_file))
139 gt_pose_lists = [
140 os.path.join(gt_file, x) for x in gt_pose_lists if x.endswith(".cam")
141 ]
142 tstamps = [float(x.split("/")[-1][:-4].split("_")[-1]) for x in gt_pose_lists]
143 gt_poses = [
144 sintel_cam_read(f)[1] for f in gt_pose_lists
145 ] # [1] means get the extrinsic
146 xyzs, wxyzs = [], []
147 tum_gt_poses = []
148 for gt_pose in gt_poses:
149 gt_pose = np.concatenate([gt_pose, np.array([[0, 0, 0, 1]])], 0)
150 gt_pose_inv = np.linalg.inv(gt_pose) # world2cam -> cam2world
151 xyz = gt_pose_inv[:3, -1]
152 xyzs.append(xyz)
153 R = Rotation.from_matrix(gt_pose_inv[:3, :3])
154 xyzw = R.as_quat() # scalar-last for scipy
155 wxyz = np.array([xyzw[-1], xyzw[0], xyzw[1], xyzw[2]])
156 wxyzs.append(wxyz)
157 tum_gt_pose = np.concatenate([xyz, wxyz], 0) # TODO: check if this is correct
158 tum_gt_poses.append(tum_gt_pose)
159
160 tum_gt_poses = np.stack(tum_gt_poses, 0)
161 tum_gt_poses[:, :3] = tum_gt_poses[:, :3] - np.mean(
162 tum_gt_poses[:, :3], 0, keepdims=True
163 )
164 tt = np.expand_dims(np.stack(tstamps, 0), -1)
165 return tum_gt_poses, tt
166
167
168def load_traj(gt_traj_file, traj_format="sintel", skip=0, stride=1, num_frames=None):

Callers 1

load_trajFunction · 0.85

Calls 2

sintel_cam_readFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected