MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / convert_bbox_to_z

Method convert_bbox_to_z

deeplabcut/core/trackingutils.py:371–381  ·  view source on GitHub ↗

Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form [x,y,s,r] where x,y is the centre of the box and s is the scale/area and r is the aspect ratio.

(bbox)

Source from the content-addressed store, hash-verified

369
370 @staticmethod
371 def convert_bbox_to_z(bbox):
372 """Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form
373 [x,y,s,r] where x,y is the centre of the box and s is the scale/area and r is
374 the aspect ratio."""
375 w = bbox[2] - bbox[0]
376 h = bbox[3] - bbox[1]
377 x = bbox[0] + w / 2.0
378 y = bbox[1] + h / 2.0
379 s = w * h # scale is just area
380 r = w / float(h)
381 return np.array([x, y, s, r]).reshape((4, 1))
382
383
384class SORTBase(metaclass=abc.ABCMeta):

Callers 2

updateMethod · 0.95
stateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected