def read_data(flags): intrinsics = np.loadtxt(os.path.join(flags.path, 'camera_matrix.csv'), delimiter=',') odometry = np.loadtxt(os.path.join(flags.path, 'odometry.csv'), delimiter=',', skiprows=1) poses = [] for line in odometry: # timestamp, frame, x, y, z, qx, qy, qz, qw position = line[2:5] quaternion = line[5:] T_WC = np.eye(4) T_WC[:3, :3] = Rotation.from_quat(quaternion).as_matrix() T_WC[:3, 3] = position poses.append(T_WC) depth_dir = os.path.join(flags.path, 'depth') depth_frames = [os.path.join(depth_dir, p) for p in sorted(os.listdir(depth_dir))] depth_frames = [f for f in depth_frames if '.npy' in f or '.png' in f] return { 'poses': poses, 'intrinsics': intrinsics, 'depth_frames': depth_frames }