make_bounds_size_positive¶
- make_bounds_size_positive(bounds)[source]¶
Make bounds have positive size and get horizontal/vertical flip flags.
Bounds with a negative size in either direction with have the coordinates swapped (e.g. left and right or top and bottom swapped) and a respective horizontal or vertical flip flag set in the output to reflect the swaps which occurred.
- Parameters:
bounds (IntBounds) – Length 4 array of bounds.
- Returns:
Three tuple containing positive bounds and flips: -
numpy.ndarray
- Positive bounds -bool
- Horizontal flip -bool
- Vertical flip- Return type:
Examples
>>> from tiatoolbox.utils.image import make_bounds_size_positive >>> bounds = (10, 10, 0, 0) >>> positive_bounds, flipud, fliplr = make_bounds_size_positive(bounds)