(kf, cost_matrix, tracks, detections, only_position=False)
| 130 | |
| 131 | |
| 132 | def gate_cost_matrix(kf, cost_matrix, tracks, detections, only_position=False): |
| 133 | if cost_matrix.size == 0: |
| 134 | return cost_matrix |
| 135 | gating_dim = 2 if only_position else 4 |
| 136 | gating_threshold = kalman_filter.chi2inv95[gating_dim] |
| 137 | measurements = np.asarray([det.to_xyah() for det in detections]) |
| 138 | for row, track in enumerate(tracks): |
| 139 | gating_distance = kf.gating_distance( |
| 140 | track.mean, track.covariance, measurements, only_position) |
| 141 | cost_matrix[row, gating_distance > gating_threshold] = np.inf |
| 142 | return cost_matrix |
| 143 | |
| 144 | |
| 145 | def fuse_motion(kf, cost_matrix, tracks, detections, only_position=False, lambda_=0.98): |
nothing calls this directly
no test coverage detected