MCPcopy Create free account
hub / github.com/Robbyant/lingbot-map / load_point_cloud_grid

Method load_point_cloud_grid

benchmark/benchmark/core/loader.py:401–549  ·  view source on GitHub ↗

Load colored point cloud in world coordinates. This method loads colored 3D point clouds in world coordinate system from two sources: (1) If load_point_list() returns point cloud data, use the point cloud xyz directly (2) If load_point_list() returns no point cloud, use load

(
        self,
        confidence_threshold: float = 0.0,
        use_aoi_mask: bool = False
    )

Source from the content-addressed store, hash-verified

399 return None
400
401 def load_point_cloud_grid(
402 self,
403 confidence_threshold: float = 0.0,
404 use_aoi_mask: bool = False
405 ) -> Tuple[np.ndarray, np.ndarray]:
406 """Load colored point cloud in world coordinates.
407
408 This method loads colored 3D point clouds in world coordinate system from two sources:
409 (1) If load_point_list() returns point cloud data, use the point cloud xyz directly
410 (2) If load_point_list() returns no point cloud, use load_depth_list() to get depth maps,
411 combine with load_intrinsics() camera intrinsics to backproject depth into xyz points,
412 and use load_trajectory() camera poses to transform points from camera to world coords.
413 Then combine with load_rgb_list() RGB images to get point cloud color information.
414
415 Args:
416 confidence_threshold: Percentile threshold (0-1) to filter points based on confidence maps.
417 If > 0, only points with confidence above this percentile are kept.
418 Default 0.0 means no filtering.
419 use_aoi_mask: If True, apply area-of-interest masks from mask/ directory
420 (checks data_dir/mask/ first, then sibling gt/mask/).
421 Only pixels where the mask is non-zero are kept.
422 Default False. Typically only enabled during evaluation.
423
424 Returns:
425 xyzrgb: DxHxWx6 float32 array (xyz in meters, rgb in [0,1])
426 mask: DxHxW boolean mask where valid points exist (filtered by confidence if threshold > 0)
427 """
428 N = self.get_num_frames()
429 if N == 0:
430 raise ValueError("No frames found")
431
432 point_list = self.load_points_list()
433 use_point_cloud = (point_list is not None and all(p is not None for p in point_list))
434
435 rgb_list = self.load_rgb_list()
436
437 traj_array = self.load_trajectory()
438 if traj_array is None:
439 raise FileNotFoundError(f"Trajectory file not found in {self.artifact}")
440
441 if not use_point_cloud:
442 depth_list = self.load_depth_list()
443 intrinsics_array = self.load_intrinsics()
444
445 if depth_list is None:
446 raise FileNotFoundError(f"Depth directory not found in {self.artifact}")
447 if intrinsics_array is None:
448 raise FileNotFoundError(f"Intrinsics file not found in {self.artifact}")
449 if any(d is None for d in depth_list):
450 raise ValueError("Some depth maps are missing")
451
452 H, W = rgb_list[0].shape[:2]
453
454 xyzrgb = np.zeros((N, H, W, 6), dtype=np.float32)
455 mask = np.zeros((N, H, W), dtype=bool)
456
457 if use_point_cloud:
458 for i in range(N):

Callers 4

evaluate_pointcloudMethod · 0.80
evaluate_pointcloudMethod · 0.80
evaluate_pointcloudMethod · 0.80

Calls 9

get_num_framesMethod · 0.95
load_points_listMethod · 0.95
load_rgb_listMethod · 0.95
load_trajectoryMethod · 0.95
load_depth_listMethod · 0.95
load_intrinsicsMethod · 0.95
load_confidence_listMethod · 0.95
_resolve_aoi_mask_dirMethod · 0.95
existsMethod · 0.80

Tested by

no test coverage detected