Main Content

labelDataAtTime

Get scene label data at specified timestamps

Description

example

labelData = labelDataAtTime(sceneData,labelNames,timestamps) returns the scene label data at the specified timestamps and for the specified label names present in a SceneLabelData object, sceneData.

Examples

collapse all

Get the scene label data present at a specific time range in 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 label data for the weather-related scene labels ("sunny" and "rainy") over the time range that the "urban" scene label is applied.

weatherLabelNames = ["sunny" "rainy"];
urbanTimestamps = seconds(0:8);
weatherLabelData = labelDataAtTime(sceneData,weatherLabelNames,urbanTimestamps)
weatherLabelData=9×2 timetable
    timeStamps    sunny    rainy
    __________    _____    _____

    0 sec         true     false
    1 sec         true     false
    2 sec         true     false
    3 sec         true     false
    4 sec         true     false
    5 sec         true     false
    6 sec         false    true 
    7 sec         false    true 
    8 sec         false    true 

Input Arguments

collapse all

Scene label data, specified as a SceneLabelData object.

Scene label names, specified as a string vector. The scene label names must be present in the sceneData input.

Example: ["sunny" "rainy"]

Timestamps, specified as a duration vector.

Example: seconds(5:10) specifies a duration vector from 5 to 10 seconds.

Output Arguments

collapse all

Scene label data at specified timestamps, returned as a timetable. The first column contains the timestamps specified by the timestamps input. The remaining columns correspond to the scene labels specified by the labelNames input. These columns contain logical 1 (true) and logical 0 (false) values that specify the scene labels present at each timestamp in the input sceneData.

Introduced in R2020a