Plane detection
Instantiate a plane detector
- limap.image.groups.planelib.get_plane_detector(method: str, plane_options: DetectorOptions)
Get a plane detector
- class limap.image.groups.planelib.DetectorOptions(base_options: limap.image.groups.planelib.base_plane_detector.BasePlaneDetectorOptions = <factory>, pxwplanar_options: limap.image.groups.planelib.register_plane_detector.PxwPlanarOptions = <factory>)
- __init__(base_options: BasePlaneDetectorOptions = <factory>, pxwplanar_options: PxwPlanarOptions = <factory>) None
- base_options: BasePlaneDetectorOptions
- pxwplanar_options: PxwPlanarOptions
- class limap.image.groups.planelib.PxwPlanarOptions(model_path: str = 'alpayozkan/pxwplanar-moge2-planarity', device: str = 'cuda', num_tokens: int = 1600, threshold_planarity: float = 0.3, normal_threshold_deg: float = 5.0, depth_threshold: float = 0.025, neighbor_match_count_thresh: int = 8)
Options for the MoGe 4-head planarity detector. The segmentation defaults are the canonical parameters of the pxwplanar benchmark.
- __init__(model_path: str = 'alpayozkan/pxwplanar-moge2-planarity', device: str = 'cuda', num_tokens: int = 1600, threshold_planarity: float = 0.3, normal_threshold_deg: float = 5.0, depth_threshold: float = 0.025, neighbor_match_count_thresh: int = 8) None
- depth_threshold: float = 0.025
- device: str = 'cuda'
- model_path: str = 'alpayozkan/pxwplanar-moge2-planarity'
- neighbor_match_count_thresh: int = 8
- normal_threshold_deg: float = 5.0
- num_tokens: int = 1600
- threshold_planarity: float = 0.3
Base interface
- class limap.image.groups.planelib.base_plane_detector.BasePlaneDetector(options: BasePlaneDetectorOptions)
- __init__(options: BasePlaneDetectorOptions)
- detect_plane_mask(image_name: Path) ndarray
Single-view plane segmentation. Filter and ensure continous labels.
- detect_plane_mask_with_normals(image_name: Path) tuple[ndarray, ndarray | None]
Detect planes and optionally return normal map.
- Returns:
(H, W) filtered plane mask with continuous labels normal_map: (H, W, 3) normal map or None if not supported
- Return type:
plane_mask
- get_module_name() str
Virtual method (need to be implemented) - return the name of the module
Conversion utilities
- limap.image.groups.planelib.convert_plane_mask_to_groups2d(plane_mask: ndarray, points: ndarray, lines: list[Line2d], min_line_overlap_length: float = 40.0, dilation_radius: float = 2.0, normal_map: ndarray | None = None) list[Group2d]
Convert a plane segmentation mask to Group2d objects.
- Parameters:
plane_mask – (H, W) int array with plane labels (0 = background)
points – (N, 2) array of 2D point coordinates
lines – list of Line2d objects
min_line_overlap_length – minimum overlap length to associate a line
dilation_radius – radius for dilating plane regions
normal_map – optional (H, W, 3) array of per-pixel normal vectors. If provided, average normals are computed per plane and stored as Group2d params.
- Returns:
List of Group2d objects, one per plane label (1..num_planes)
Visualization
- limap.image.groups.planelib.visualize_top_components(segmentation: ndarray, top_n: int = 10, ignore_label: int = 0, colormap: str = 'hls', background_image: ndarray | None = None, alpha: float = 0.5)
Visualize top-n largest plane segments with distinct colors.
- Parameters:
segmentation – (H, W) segmentation map with plane IDs
top_n – Number of top planes to show
ignore_label – Label to treat as background (default 0)
colormap – Seaborn color palette name
background_image – Optional (H, W, 3) BGR image to blend with
alpha – Blending factor for overlay (0=background only, 1=colors only)
- Returns:
(H, W, 3) BGR image
- Return type:
colored_seg
- limap.image.groups.planelib.visualize_single_component(segmentation: ndarray, target_label: int, color: tuple[int, ...] = (255, 0, 0), background_image: bool | None = None, alpha: float = 0.6)
visualization of only one connected component. segmentation : 2D array of labels target_label : label id to highlight color : RGB tuple (default red)
- limap.image.groups.planelib.visualize_plane_tracks(db_path: Path, structure_db_path: Path, workspace_path: Path, image_dir: Path, neighbors: dict, recon, output_dir: Path)