pyorc.CrossSection.detect_water_level#

CrossSection.detect_water_level(img: np.ndarray, bank: BANK_OPTIONS = 'far', bin_size: int = 5, length: float = 2.0, padding: float = 0.5, offset: float = 0.0) float[source]#

Detect water level optically from provided image.

Water level detection is done by first detecting the water line along the cross-section by comparisons of distribution functions left and right of hypothesized water lines, and then looking up the water level associated with the water line location.

Parameters:
  • img (np.ndarray) – image (uint8) used to estimate water level from.

  • bank (Literal["far", "near", "both"], optional) – select from which bank to detect the water level. Use this if camera is positioned in a way that only one shore is clearly distinguishable and not obscured. Typically you will use “far” if the camera is positioned on one bank, aimed perpendicular to the flow. Use “near” if not the full cross section is visible, but only the part nearest the camera. And leave empty when both banks are clearly visible and approximately the same in distance (e.g. middle of a bridge). If not provided, the bank is detected based on the best estimate from both banks.

  • bin_size (int, optional) – Size of bins for histogram calculation of the provided image intensities, default 5.

  • length (float, optional) – length of the waterline [m], by default 2.0

  • padding (float, optional) – amount of distance [m] to extend the polygon beyond the waterline, by default 0.5. Two polygons are drawn left and right of hypothesized water line at -padding and +padding.

  • offset (float, optional) – perpendicular offset of the waterline from the cross-section [m], by default 0.0