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)
| 31 | |
| 32 | |
| 33 | def convert_bbox_to_z(bbox): |
| 34 | """ |
| 35 | Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form |
| 36 | [x,y,s,r] where x,y is the centre of the box and s is the scale/area and r is |
| 37 | the aspect ratio |
| 38 | """ |
| 39 | w = bbox[2] - bbox[0] |
| 40 | h = bbox[3] - bbox[1] |
| 41 | x = bbox[0] + w / 2. |
| 42 | y = bbox[1] + h / 2. |
| 43 | s = w * h # scale is just area |
| 44 | r = w / float(h) |
| 45 | return np.array([x, y, s, r]).reshape((4, 1)) |
| 46 | |
| 47 | |
| 48 | def convert_x_to_bbox(x, score=None): |