Initialises a tracker using initial bounding box.
(self,bbox)
| 86 | """ |
| 87 | count = 0 |
| 88 | def __init__(self,bbox): |
| 89 | """ |
| 90 | Initialises a tracker using initial bounding box. |
| 91 | """ |
| 92 | #define constant velocity model |
| 93 | self.kf = KalmanFilter(dim_x=7, dim_z=4) |
| 94 | self.kf.F = np.array([[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], [0,0,0,0,1,0,0],[0,0,0,0,0,1,0],[0,0,0,0,0,0,1]]) |
| 95 | self.kf.H = np.array([[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]]) |
| 96 | |
| 97 | self.kf.R[2:,2:] *= 10. |
| 98 | self.kf.P[4:,4:] *= 1000. #give high uncertainty to the unobservable initial velocities |
| 99 | self.kf.P *= 10. |
| 100 | self.kf.Q[-1,-1] *= 0.01 |
| 101 | self.kf.Q[4:,4:] *= 0.01 |
| 102 | |
| 103 | self.kf.x[:4] = convert_bbox_to_z(bbox) |
| 104 | self.time_since_update = 0 |
| 105 | self.id = KalmanBoxTracker.count |
| 106 | KalmanBoxTracker.count += 1 |
| 107 | self.history = [] |
| 108 | self.hits = 0 |
| 109 | self.hit_streak = 0 |
| 110 | self.age = 0 |
| 111 | |
| 112 | def update(self,bbox): |
| 113 | """ |
nothing calls this directly
no test coverage detected