pyflwdir.regions.region_bounds#
- pyflwdir.regions.region_bounds(regions: ndarray, transform: Affine = Affine(1.0, 0.0, 0.0, 0.0, -1.0, 0.0)) tuple[ndarray, ndarray, ndarray][source]#
Return the bounding box of each unique label in regions.
NOTE: a region must be a connected area with the same ID, where IDs are integer values greater than zero.
- Parameters:
regions (2D array of int) – Raster of positive region IDs.
transform (Affine) – Coefficients mapping pixel coordinates to coordinate reference system.
- Returns:
lbs (1D array) – array of the unique region IDs
bboxs (2D array with shape (lbs.size, 4)) – bounding box [xmin, ymin, xmax, ymax] for each label
total_bbox (1D array) – total bounding box of all regions