Main Content


Time ranges of scene labels from ground truth data



timeRanges = sceneTimeRanges(gTruth) returns the time ranges that define the start and end times for the scene labels applied to the ground truth data sources in gTruth.

[timeRanges,sceneLabels] = sceneTimeRanges(gTruth) also returns the scene labels that correspond to the time ranges.


collapse all

Load ground truth scene label definitions and label data into the workspace.

data = load("groundTruthSceneLabels.mat");
labelDefinitions = data.labelDefinitions;
labelData = data.labelData;

Create a ground truth data source using a video file.

gSource = groundTruthDataSource("viptrain.avi");

Create a ground truth object using the ground truth data source.

gTruth = groundTruth(gSource,labelDefinitions,labelData);

Gather all the scene time ranges and the scene labels.

[timeRanges,sceneLabels] = sceneTimeRanges(gTruth);

Display the scene time ranges for the ground truth data.

ans = 3x2 duration
        0 sec   8.0333 sec
      8.3 sec   10.033 sec
       12 sec   16.333 sec

Display the corresponding scene labels for the ground truth data.

ans = 3x1 categorical

Input Arguments

collapse all

Ground truth, specified as a vector of groundTruth objects or groundTruthMultisignal (Automated Driving Toolbox) objects.

Output Arguments

collapse all

Time ranges of the ground truth source data, returned as an M-by-1 cell array. M is the number of elements in gTruth. Each of the cell array contains a T-by-2 duration matrix. T is the number of time ranges in the corresponding element of gTruth. Each row of the matrices corresponds to a time range in the ground truth data for which a scene label has been applied, specified in the form [rangeStart rangeEnd].

To select and obtain scene time ranges for specific signals in a groundTruthMultisignal (Automated Driving Toolbox) object, use the selectLabelsBySignalName (Automated Driving Toolbox) function before calling the sceneTimeRanges function.

Scene labels for each time range, returned as an M-by-1 cell array of T-by-2 categorical vectors. M is the number of elements in gTruth. T is the number of time ranges in each corresponding ground truth data source.

Introduced in R2021b