LocalAerialEvidence#
- class rapidtools.processing.aerial_evidence.LocalAerialEvidence(detections: list[BaseGeometry], coverage: BaseGeometry | None, occluders: BaseGeometry | None, hit: float, miss: float)[source]#
Bases:
objectAerial evidence in a local meter frame (see
AerialEvidence.to_local()).- Variables:
detections (list[shapely.geometry.base.BaseGeometry]) – Outlines in meters.
coverage (shapely.geometry.base.BaseGeometry | None) – Ground the detector looked at, or
None.occluders (shapely.geometry.base.BaseGeometry | None) – Ground it cannot see, or
None.hit (float) – Log-odds added inside an outline.
miss (float) – Log-odds added on visible ground without one.
Methods
Indices of the outlines that reach into
(x0, y0, x1, y1).Lay the evidence on a grid of
nyrows bynxcolumns.- detections_in(bounds: tuple[float, float, float, float]) list[int][source]#
Indices of the outlines that reach into
(x0, y0, x1, y1).
- layers(x0: float, y0: float, cell: float, nx: int, ny: int) tuple[ndarray, ndarray][source]#
Lay the evidence on a grid of
nyrows bynxcolumns.Row
jand columniare the cell whose lower left corner is(x0 + i * cell, y0 + j * cell). A cell counts as covered by a shape when its center lies inside it.- Returns:
tuple[numpy.ndarray, numpy.ndarray] – The log-odds per cell (
hitinside an outline,misson visible ground in the coverage,0elsewhere) and the outline per cell (index intodetectionsplus one;0for none).
Example
>>> from shapely.geometry import box >>> local = LocalAerialEvidence([box(1, 1, 2, 2)], box(0, 0, 4, 4), None, ... 2.0, -1.0) >>> log_odds, outline = local.layers(0.0, 0.0, 0.5, 8, 8) >>> int((outline == 1).sum()), float(log_odds[0, 0]), float(log_odds[3, 3]) (4, -1.0, 2.0)