img_processing#
Source code: armscan_env/util/img_processing.py
We use shape naming conventions in this module (applied to all variables).
hw: height, width. Sometimes also called y_size and x_size yx: y, x (positions).
- centered_constrained_bbox(limiting_bbox_yxhw: tuple[int, int, int, int], new_bbox_shape_hw: tuple[int, int]) tuple[int, int, int, int] [source]#
Returns a bounding box centered on and contained within the limiting bounding box with the specified shape. A bounding box is a tuple of type (y_pos, x_pos, height, width) where (y_pos, x_pos) point to the upper left corner.
Can be interpreted as "center cropping" the input bounding box to the specified shape.
- Parameters:
limiting_bbox_yxhw -- Bounding box that new bbox is contained within and centered on
new_bbox_shape_hw -- Shape of centered bounding box
- Returns:
Centered bounding box