Main Content

selectLabelsByType

Select ground truth data by label type

Description

example

gtLabel = selectLabelsByType(gTruth,labelTypes) selects labels of the types specified by labelTypes from a groundTruthLidar object gTruth. The function returns a corresponding groundTruthLidar object gtLabel that contains only the selected labels. If gTruth is a vector of groundTruthLidar objects, then the function returns a vector of corresponding groundTruthLidar objects that contain only the selected labels.

Examples

collapse all

Load a groundTruthLidar object containing labels of various groups, types, and names into the workspace.

lidarDir = fullfile(matlabroot,'toolbox','lidar','lidardata','lidarLabeler');
addpath(lidarDir)
load('lidarLabelerGTruth.mat')

Inspect the label definitions. The object contains label definitions of type Cuboid and Scene.

lidarLabelerGTruth.LabelDefinitions
ans =

  5×5 table

         Name          Type      LabelColor        Group       Description
    ______________    ______    ____________    ___________    ___________

    {'car'       }    Cuboid    {1×3 double}    {'vehicle'}    {0×0 char} 
    {'bike'      }    Cuboid    {1×3 double}    {'vehicle'}    {0×0 char} 
    {'pole'      }    Cuboid    {1×3 double}    {'None'   }    {0×0 char} 
    {'vegetation'}    Cuboid    {1×3 double}    {'None'   }    {0×0 char} 
    {'road'      }    Scene     {1×3 double}    {'None'   }    {0×0 char}

Create a new groundTruthLidar object that contains only the label definitions with the type 'Cuboid'.

labelType = labelType.Cuboid;
gtLidarLabel = selectLabelsByType(lidarLabelerGTruth,labelType)
 = 

  groundTruthLidar with properties:

          DataSource: [1×1 vision.labeler.loading.PointCloudSequenceSource]
    LabelDefinitions: [4×5 table]
           LabelData: [1×4 timetable]

View the label definitions of the returned groundTruthLidar object.

lidarLabelerGTruth.LabelDefinitions
ans =

  4×5 table

         Name          Type      LabelColor        Group       Description
    ______________    ______    ____________    ___________    ___________

    {'car'       }    Cuboid    {1×3 double}    {'vehicle'}    {0×0 char} 
    {'bike'      }    Cuboid    {1×3 double}    {'vehicle'}    {0×0 char} 
    {'pole'      }    Cuboid    {1×3 double}    {'None'   }    {0×0 char} 
    {'vegetation'}    Cuboid    {1×3 double}    {'None'   }    {0×0 char} 

Input Arguments

collapse all

Lidar ground truth data, specified as a groundTruthLidar object or vector of groundTruthLidar objects.

Label types, specified as a labelType enumeration or vector of labelType enumerations.

To view all distinct label types in a groundTruthLidar object, enter this command at the MATLAB® command prompt.

unique(gTruth.LabelDefinitions.LabelType)

Example: labelType.Cuboid

Example: [labelType.Cuboid labelType.Scene]

Output Arguments

collapse all

Ground truth with only the selected labels, returned as a groundTruthLidar object or vector of groundTruthLidar objects.

Each groundTruthLidar object in gtLabel corresponds to a groundTruthLidar object in the gTruth input. The returned objects contain only the labels that are of the label types specified by the labelTypes input.

Introduced in R2020b