MCPcopy Create free account
hub / github.com/Ropedia/SpatialBench / _parse_kitti_poses

Function _parse_kitti_poses

visualize_benchmark_web.py:1051–1065  ·  view source on GitHub ↗

解析 poses/XX.txt,每行 12 float,reshape (N,3,4) c2w。文件不存在返回空数组。

(path: Path)

Source from the content-addressed store, hash-verified

1049
1050
1051def _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
1068def _load_kitti_odometry(data_root: Path, scene_path: str, frame_indices: list):

Callers 1

_load_kitti_odometryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected