解析 poses/XX.txt,每行 12 float,reshape (N,3,4) c2w。文件不存在返回空数组。
(path: Path)
| 1049 | |
| 1050 | |
| 1051 | def _parse_kitti_poses(path: Path) -> np.ndarray: |
| 1052 | """解析 poses/XX.txt,每行 12 float,reshape (N,3,4) c2w。文件不存在返回空数组。""" |
| 1053 | if not path.is_file(): |
| 1054 | return np.zeros((0, 3, 4), dtype=np.float32) |
| 1055 | poses = [] |
| 1056 | with open(path) as f: |
| 1057 | for line in f: |
| 1058 | line = line.strip() |
| 1059 | if not line: |
| 1060 | continue |
| 1061 | vals = [float(x) for x in line.split()] |
| 1062 | if len(vals) < 12: |
| 1063 | continue |
| 1064 | poses.append(np.array(vals[:12], dtype=np.float32).reshape(3, 4)) |
| 1065 | return np.stack(poses) if poses else np.zeros((0, 3, 4), dtype=np.float32) |
| 1066 | |
| 1067 | |
| 1068 | def _load_kitti_odometry(data_root: Path, scene_path: str, frame_indices: list): |
no outgoing calls
no test coverage detected