MCPcopy Create free account
hub / github.com/MotrixLab/ADHMR / resize_bbox

Function resize_bbox

HMR-Scorer/common/utils/preprocessing.py:849–862  ·  view source on GitHub ↗
(bbox, scale=1.2)

Source from the content-addressed store, hash-verified

847 return v
848
849def resize_bbox(bbox, scale=1.2):
850 if isinstance(bbox, list):
851 x1, y1, x2, y2 = bbox[0], bbox[1], bbox[2], bbox[3]
852 else:
853 x1, y1, x2, y2 = bbox
854 x_center = (x1+x2)/2.0
855 y_center = (y1+y2)/2.0
856 x_size, y_size = x2-x1, y2-y1
857 x1_resize = x_center-x_size/2.0*scale
858 x2_resize = x_center+x_size/2.0*scale
859 y1_resize = y_center - y_size / 2.0 * scale
860 y2_resize = y_center + y_size / 2.0 * scale
861 bbox[0], bbox[1], bbox[2], bbox[3] = x1_resize, y1_resize, x2_resize, y2_resize
862 return bbox

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected