Main Content

smooth

Smooth track estimates using JIPDA

Since R2023a

Description

smoothTracks = smooth(smoother,detectionLog) returns the smoothed tracks by processing detections using the smoother.

smoothTracks = smooth(smoother,detectionLog,timeStamps) additionally specifies time stamps at which the smoother must report smoothed tracks.

example

Examples

collapse all

Load recorded detections and truth log.

load("smootherDetectionData.mat","detectionLog","timestamps","truthLog")

Create a smootherJIPDA object and set its FilterInitializtionFcn property to initialize a trackingEKF object with a constant velocity model.

smoother = smootherJIPDA(FilterInitializationFcn="initcvekf");

Obtain the smoothed tracks by using the smooth object function. Use the time stamps input to let the smoother output smoothed tracks at these stamps.

smoothTracks = smooth(smoother,detectionLog,timestamps);

To compare the smoothed results with an online tracking JIPDA algorithm, create a trackerJPDA object, update the tracker with detections, and obtain tracks.

tracker = trackerJPDA("TrackLogic","Integrated","FilterInitializationFcn","initcvekf");

detectionTimes = cellfun(@(x)x.Time,detectionLog);
onlineTracks = cell(numel(timestamps),1);

for i = 1:numel(timestamps)
    detections = detectionLog(detectionTimes == timestamps(i));
    onlineTracks{i} = tracker(detections,timestamps(i));
end

Compare tracking performances using the OSPA(2) metric. In this case, the smoother results have a much lower OSPA(2) metric and thus show better tracking performance than online tracking.

ospaOnlineCalc = trackOSPAMetric(Metric="OSPA(2)");
ospaSmoothCalc = trackOSPAMetric(Metric="OSPA(2)");
ospaOnline = zeros(numel(timestamps),1);
ospaSmooth = zeros(numel(timestamps),1);
for i = 1:numel(timestamps)
    ospaOnline(i) = ospaOnlineCalc(onlineTracks{i},truthLog{i});
    ospaSmooth(i) = ospaSmoothCalc(smoothTracks{i},truthLog{i});
end

% Plot OSPA(2) metrics
plot(timestamps, [ospaOnline ospaSmooth],"LineWidth",2);
xlabel("time");
ylabel("OSPA(2)");
legend({"Online","Smooth"});

Figure contains an axes object. The axes object with xlabel time, ylabel OSPA(2) contains 2 objects of type line. These objects represent Online, Smooth.

Input Arguments

collapse all

JIPDA smoother, specified as a smootherJIPDA object.

Log of detections, specified as a cell array of objectDetection objects. Specify this argument as detections from all the time stamps considered for tracking.

Time stamps at which the smoother must report smoothed tracks, specified as a vector of nonnegative scalars.

Output Arguments

collapse all

Smoothed tracks, returned as a cell array of objectTrack objects. The smoother reports tracks at the timeStamps if specified or the unique time stamps of detections. The smoother differentiates two detection time stamps if their difference is larger than the TimeTolerance property of the smoother. If not, the smoother ignores their time difference and regards them as having the same time stamp.

Version History

Introduced in R2023a