MCPcopy Create free account
hub / github.com/Vegetebird/GraphMLP / convert_x_to_bbox

Function convert_x_to_bbox

demo/lib/sort/sort.py:48–58  ·  view source on GitHub ↗

Takes a bounding box in the centre form [x,y,s,r] and returns it in the form [x1,y1,x2,y2] where x1,y1 is the top left and x2,y2 is the bottom right

(x, score=None)

Source from the content-addressed store, hash-verified

46
47
48def convert_x_to_bbox(x, score=None):
49 """
50 Takes a bounding box in the centre form [x,y,s,r] and returns it in the form
51 [x1,y1,x2,y2] where x1,y1 is the top left and x2,y2 is the bottom right
52 """
53 w = np.sqrt(x[2] * x[3])
54 h = x[2] / w
55 if (score == None):
56 return np.array([x[0] - w / 2., x[1] - h / 2., x[0] + w / 2., x[1] + h / 2.]).reshape((1, 4))
57 else:
58 return np.array([x[0] - w / 2., x[1] - h / 2., x[0] + w / 2., x[1] + h / 2., score]).reshape((1, 5))
59
60
61class KalmanBoxTracker(object):

Callers 2

predictMethod · 0.85
get_stateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected