bounds2locsize¶
- bounds2locsize(bounds, origin='upper')[source]¶
Calculate the size of a tuple of bounds.
Bounds are expected to be in the (left, top, right, bottom) or (start_x, start_y, end_x, end_y) format.
- Parameters:
- Returns:
A set of two arrays containing integer for location and size:
- location array
x location
y location
- size array
width
height
- Return type:
np.ndarray
Examples
>>> from tiatoolbox.utils.transforms import bounds2locsize >>> bounds = (0, 0, 10, 10) >>> location, size = bounds2locsize(bounds)
>>> from tiatoolbox.utils.transforms import bounds2locsize >>> _, size = bounds2locsize((12, 4, 24, 16))