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

Function resize_bbox

ADHMR/lib/utils/preprocessing.py:547–560  ·  view source on GitHub ↗
(bbox, scale=1.2)

Source from the content-addressed store, hash-verified

545 return v
546
547def resize_bbox(bbox, scale=1.2):
548 if isinstance(bbox, list):
549 x1, y1, x2, y2 = bbox[0], bbox[1], bbox[2], bbox[3]
550 else:
551 x1, y1, x2, y2 = bbox
552 x_center = (x1+x2)/2.0
553 y_center = (y1+y2)/2.0
554 x_size, y_size = x2-x1, y2-y1
555 x1_resize = x_center-x_size/2.0*scale
556 x2_resize = x_center+x_size/2.0*scale
557 y1_resize = y_center - y_size / 2.0 * scale
558 y2_resize = y_center + y_size / 2.0 * scale
559 bbox[0], bbox[1], bbox[2], bbox[3] = x1_resize, y1_resize, x2_resize, y2_resize
560 return bbox

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected