(kf, cost_matrix, tracks, detections, only_position=False, lambda_=0.98)
| 185 | |
| 186 | |
| 187 | def fuse_motion(kf, cost_matrix, tracks, detections, only_position=False, lambda_=0.98): |
| 188 | if cost_matrix.size == 0: |
| 189 | return cost_matrix |
| 190 | gating_dim = 2 if only_position else 4 |
| 191 | gating_threshold = chi2inv95[gating_dim] |
| 192 | measurements = np.asarray([det.to_xyah() for det in detections]) |
| 193 | for row, track in enumerate(tracks): |
| 194 | gating_distance = kf.gating_distance( |
| 195 | track.mean, track.covariance, measurements, only_position, metric='maha') |
| 196 | cost_matrix[row, gating_distance > gating_threshold] = np.inf |
| 197 | cost_matrix[row] = lambda_ * cost_matrix[row] + (1 - lambda_) * gating_distance |
| 198 | return cost_matrix |
nothing calls this directly
no test coverage detected