-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathellipsoidalGatingforBernoulli.m
21 lines (18 loc) · 1.13 KB
/
ellipsoidalGatingforBernoulli.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function inGate = ellipsoidalGatingforBernoulli(trajectoryBernoulli,multiObjectDynamicModel,multiObjectMeasurementModel,measurements,measurementAssociation,currentTimeStep,gateSize)
if measurementAssociation(1) == 0
inGate = true;
return;
end
measurement = measurements{currentTimeStep+1}(:,measurementAssociation(1));
numTrajectoryMixture = length(trajectoryBernoulli.trajectoryMixture);
inGate = false;
for l = 1:numTrajectoryMixture
innovation = measurement-multiObjectMeasurementModel.observationMatrix*(multiObjectDynamicModel.transitionMatrix*trajectoryBernoulli.trajectoryMixture(l).marginalMean);
innovationCovariance = multiObjectMeasurementModel.observationMatrix*(multiObjectDynamicModel.transitionMatrix*trajectoryBernoulli.trajectoryMixture(l).marginalCovariance*multiObjectDynamicModel.transitionMatrix' + multiObjectDynamicModel.motionNoiseCovariance)*multiObjectMeasurementModel.observationMatrix' + multiObjectMeasurementModel.measurementNoiseCovariance;
mahalanobisDistance = innovation'/innovationCovariance*innovation;
if mahalanobisDistance < gateSize
inGate = true;
break;
end
end
end