smooth
Syntax
Description
returns the smoothed tracks by processing detections using the smoother.smoothTracks
= smooth(smoother
,detectionLog
)
additionally specifies time stamps at which the smoother must report smoothed tracks.smoothTracks
= smooth(smoother
,detectionLog
,timeStamps
)
Examples
Smooth Tracked Trajectories Using smootherJIPDA
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"});
Input Arguments
smoother
— JIPDA smoother
smootherJIPDA
object
JIPDA smoother, specified as a smootherJIPDA
object.
detectionLog
— Log of detections
cell array of objectDetection
objects
Log of detections, specified as a cell array of objectDetection
objects. Specify this argument as detections from all the
time stamps considered for tracking.
timeStamps
— Time stamps
vector of nonnegative scalars
Time stamps at which the smoother must report smoothed tracks, specified as a vector of nonnegative scalars.
Output Arguments
smoothTracks
— Smoothed tracks
cell array of objectTrack
objects
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)