Initialises a tracker using initial bounding box.
(self, bbox)
| 65 | count = 0 |
| 66 | |
| 67 | def __init__(self, bbox): |
| 68 | """ |
| 69 | Initialises a tracker using initial bounding box. |
| 70 | """ |
| 71 | # define constant velocity model |
| 72 | self.kf = KalmanFilter(dim_x=7, dim_z=4) |
| 73 | self.kf.F = np.array( |
| 74 | [[1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0, 0], |
| 75 | [0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 1]]) |
| 76 | self.kf.H = np.array( |
| 77 | [[1, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0]]) |
| 78 | |
| 79 | self.kf.R[2:, 2:] *= 10. |
| 80 | self.kf.P[4:, 4:] *= 1000. # give high uncertainty to the unobservable initial velocities |
| 81 | self.kf.P *= 10. |
| 82 | self.kf.Q[-1, -1] *= 0.01 |
| 83 | self.kf.Q[4:, 4:] *= 0.01 |
| 84 | |
| 85 | self.kf.x[:4] = convert_bbox_to_z(bbox) |
| 86 | self.time_since_update = 0 |
| 87 | self.id = KalmanBoxTracker.count |
| 88 | KalmanBoxTracker.count += 1 |
| 89 | self.history = [] |
| 90 | self.hits = 0 |
| 91 | self.hit_streak = 0 |
| 92 | self.age = 0 |
| 93 | |
| 94 | def update(self, bbox): |
| 95 | """ |
nothing calls this directly
no test coverage detected