set_range_bands

set_range_bands#

rapidtools.processing.street_fusion.set_range_bands(scan: Scan, camera_height_m: float = 2.4, min_range_m: float = 2.0, max_range_m: float = 30.0, elevation_sigma_deg: float = 0.75, range_sigma_fraction: float = 0.2, depth_factor: float = 0.5, flat: bool = False) → Scan[source]#

Turn a scan’s lower edge into an occupied range band per column.

A column whose lower edge lies below the horizon meets flat ground at camera_height / tan(depression). The band starts two standard deviations in front of that contact and ends the same distance behind it plus the object’s assumed depth. The range error has a part that grows with the square of the range (elevation_sigma_deg of pixel and pose error) and a part proportional to it (range_sigma_fraction: sloping ground, a hidden lower edge), so a close sighting pins the object down and a far one says little more than its bearing.

Runs of columns whose contact range changes smoothly are one visible face. The object is assumed to reach behind a face by depth_factor times the face’s length, and never beyond the range at which a ray over the outline’s top meets the ground (an object lower than the camera cannot hide ground behind its own shadow). Columns without a ground contact abstain: they claim nothing and clear nothing.

Parameters:
  • scan – Scan from scan_from_observation(); modified in place.

  • camera_height_m – Camera height above the ground.

  • min_range_m – Closest range a band may start at.

  • max_range_m – Contacts beyond 1.5 times this are ignored.

  • elevation_sigma_deg – One-sigma error of an outline edge’s elevation.

  • range_sigma_fraction – One-sigma range error as a share of the range.

  • depth_factor – Assumed depth of an object behind a visible face, as a share of the face’s length.

  • flat – The outline is of something that lies on the ground (a driveway, a marking). Its outline is then its plan seen aslant: a column covers the ground from where its lower edge meets it to where its upper edge does, and nothing about a depth has to be assumed. Both ends are taken as read, without a margin: a margin would widen the surface on every side, and the frames that read an edge short and those that read it long settle it between them.

Returns:

Scan – The same scan with lo, hi and contact set.

Example

>>> import numpy as np
>>> scan = Scan(0, np.arange(4), np.full(4, -16.7), np.full(4, -5.0), 1.0, 2.0)
>>> scan = set_range_bands(scan)
>>> round(scan.contact, 1), bool(scan.lo[0] < 8.0 < scan.hi[0])
(8.0, True)