Load RoboLab (Isaac Sim) format data. Layout: rgb/{XXXXXX}.png — RGB images (1280x720) depth.npy — float32 (T, H, W), z-depth in meters (invalid=0) c2w.npy — float32 (T, 4, 4), cam2world (OpenCV convention) K.npy — float32 (3, 3
(scene_dir: Path, frame_indices: list, z_far: float)
| 516 | |
| 517 | |
| 518 | def _load_robolab(scene_dir: Path, frame_indices: list, z_far: float): |
| 519 | """Load RoboLab (Isaac Sim) format data. |
| 520 | |
| 521 | Layout: |
| 522 | rgb/{XXXXXX}.png — RGB images (1280x720) |
| 523 | depth.npy — float32 (T, H, W), z-depth in meters (invalid=0) |
| 524 | c2w.npy — float32 (T, 4, 4), cam2world (OpenCV convention) |
| 525 | K.npy — float32 (3, 3), shared intrinsics |
| 526 | """ |
| 527 | rgb_dir = scene_dir / "rgb" |
| 528 | rgb_paths = sorted(rgb_dir.glob("*.png")) |
| 529 | |
| 530 | K = np.load(str(scene_dir / "K.npy")).astype(np.float32) |
| 531 | all_depth = np.load(str(scene_dir / "depth.npy")) # (T, H, W) float32 |
| 532 | all_c2w = np.load(str(scene_dir / "c2w.npy")).astype(np.float32) # (T, 4, 4) |
| 533 | |
| 534 | images, depths, extrinsics = [], [], [] |
| 535 | for idx in frame_indices: |
| 536 | if idx >= len(rgb_paths) or idx >= len(all_depth) or idx >= len(all_c2w): |
| 537 | continue |
| 538 | |
| 539 | # RGB |
| 540 | img = cv2.imread(str(rgb_paths[idx])) |
| 541 | if img is not None: |
| 542 | img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) |
| 543 | else: |
| 544 | img = np.zeros((720, 1280, 3), dtype=np.uint8) |
| 545 | |
| 546 | # Depth: 已为米, 直接使用 |
| 547 | depth = np.ascontiguousarray(all_depth[idx].astype(np.float32)) |
| 548 | depth[~np.isfinite(depth)] = 0 |
| 549 | depth[depth > z_far] = 0 |
| 550 | |
| 551 | # Pose: 4x4 cam2world -> (3, 4) |
| 552 | pose = all_c2w[idx][:3, :].astype(np.float32) |
| 553 | |
| 554 | images.append(img) |
| 555 | depths.append(depth) |
| 556 | extrinsics.append(pose) |
| 557 | |
| 558 | return { |
| 559 | "images": images, "depths": depths, |
| 560 | "extrinsics": extrinsics, "K": K, |
| 561 | } |
| 562 | |
| 563 | |
| 564 | def _load_rlbench(scene_dir: Path, frame_indices: list, z_far: float, use_depth_mask: bool = True): |