Main Content


Get scene label definition names at specified timestamp

Since R2020a



labelNames = labelDefinitionsAtTime(sceneData,timestamp) returns the scene label definition names that are applied at the specified timestamp in a SceneLabelData object, sceneData.


collapse all

Get the scene label definition names that are applied at the first timestamp of a SceneLabelData object.

Create a SceneLabelData object. The object has labels for specifying whether a scene is sunny, rainy, urban, or rural. The scene labels are applied at these time ranges.

  • "sunny" — 0 to 5 seconds

  • "rainy" — 6 to 10 seconds

  • "urban" — 0 to 8 seconds

  • "rural" — 9 to 10 seconds

labelNames = ["sunny" "rainy" "urban" "rural"];

sunnyData = seconds([0 5]);
rainyData = seconds([6 10]);
urbanData = seconds([0 8]);
ruralData = seconds([9 10]);

labelData = {sunnyData rainyData urbanData ruralData};
sceneData = vision.labeler.labeldata.SceneLabelData(labelNames,labelData);

Get the scene labels that are applied at the start of the time range, that is, the first timestamp.

tsStart = 0;
labelNamesAtStart = labelDefinitionsAtTime(sceneData,tsStart)
labelNamesAtStart = 1x2 string
    "sunny"    "urban"

Input Arguments

collapse all

Scene label data, specified as a SceneLabelData object.

Timestamp, specified as a duration scalar.

Example: seconds(9.5) specifies a duration scalar of 9.5 seconds.

Output Arguments

collapse all

Scene label definition names, returned as a string vector. The vector contains the names of scene label definitions at the input timestamp in the input sceneData.

Version History

Introduced in R2020a