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)
| 46 | |
| 47 | |
| 48 | def 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 | |
| 61 | class KalmanBoxTracker(object): |