footprint_region

footprint_region#

rapidtools.processing.street_footprints.footprint_region(footprint: Polygon, rotation: ndarray, camera: ndarray, base_m: float, top_m: float) → tuple[Polygon | None, float][source]#

The part of a panorama a footprint raised to a box projects onto.

Parameters:
  • footprint – Footprint in the local meter frame.

  • rotation – 3 x 3 world-to-camera rotation matrix.

  • camera – Camera center (east, north, altitude).

  • base_m – Altitude of the foot of the box.

  • top_m – Altitude of its top.

Returns:

tuple[Polygon | None, float] – The convex outline of the box in normalized image coordinates and the distance from the camera to the nearest corner. The outline of a box across the left/right seam of the panorama runs past 1 on the right. None when the box projects onto a line.

Example

>>> import numpy as np
>>> house = Polygon([(-5, 10), (5, 10), (5, 20), (-5, 20)])
>>> level = np.array([[1.0, 0, 0], [0, 0, -1.0], [0, 1.0, 0]])  # looking north
>>> region, nearest = footprint_region(house, level, np.zeros(3), -2.0, 6.0)
>>> round(region.centroid.x, 2), round(nearest, 1)
(0.5, 10.2)