discover_structures

discover_structures#

rapidtools.processing.street_structures.discover_structures(observations: Sequence[Observation], clusters: Mapping[str, tuple[str, str]], *, cache_dir: str | Path | None = None, camera_height_m: float = 2.4, max_range_m: float = 40.0, min_vote_fraction: float = 0.7, min_votes: int = 3, min_height_m: float = 2.0, cell_m: float = 0.5, min_cell_points: int = 2, min_gap_m: float = 1.0, min_points: int = 40, min_frontage_m: float = 4.0, assumed_depth_m: float = 10.0, footprint: str = 'stepped', max_views: int = 12, max_workers: int = 8, project: Callable[[float, float], tuple[float, float]] | None = None, unproject: Callable[[float, float], tuple[float, float]] | None = None, loader: Callable[[str, str], PointCloud | None] | None = None) → tuple[list[Structure], dict[str, int], Callable[[float, float], tuple[float, float]]][source]#

Find the structures of one class in a survey’s point clouds.

See the module docstring for the method.

Parameters:
  • observations – Sightings of the class (panoramas with a computed_rotation in extra).

  • clusters – For every image ID, the (cluster_id, url) of its sfm_cluster. Images without an entry are not used.

  • cache_dir – Folder where downloaded point clouds are cached.

  • camera_height_m – Camera height above the road; sets the ground level heights are measured from where the point cloud has no ground points of its own.

  • max_range_m – Farthest a frame votes on a point, and farthest frame a structure gets a sighting from.

  • min_vote_fraction – Share of the frames within range that must place a point on the class.

  • min_votes – Frames that must place a point on the class.

  • min_height_m – Points lower than this above the ground are ignored when grouping (shrubs, fences, parked cars).

  • cell_m – Ground cell used to find dense wall fragments.

  • min_cell_points – Fewest points a cell needs to count as wall. The cut used is the upper quartile of the occupied cells when that is higher, so it adapts to how densely the survey was driven.

  • min_gap_m – Free ground that separates two wall pieces. Pieces up to three times as far apart along the street are still joined when the frames in front of them outline them as one building.

  • min_points – Fewest points a structure may have.

  • min_frontage_m – Shortest facade reported.

  • assumed_depth_m – Footprint depth where the rear was not seen.

  • footprint – 'stepped' (the front follows the setbacks of the facade, rear filled in), 'rectangle' (one facade-aligned rectangle, rear filled in) or 'observed' (convex outline of the points seen, nothing assumed).

  • max_views – Sightings kept per structure, spread over the directions it was seen from among the closer frames; 0 keeps one per frame in range.

  • max_workers – Threads for point-cloud downloads.

  • project – Projection to local meters; made from the sightings when omitted.

  • unproject – Inverse of project.

  • loader – loader(cluster_id, url) returning a PointCloud, instead of downloading (for tests and offline use).

Returns:

tuple[list[Structure], dict[str, int], Unproject] – The structures, counters describing the run and the inverse projection.

Example

>>> structures, counts, unproject = discover_structures(
...     sightings, clusters, cache_dir='point_clouds'
... )
>>> counts['structures']
212