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 2-tuple containing integer 2-tuples for location and size:
- Return type:
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))