Main Content

selectLabelsByGroup

Select ground truth data by label group name

Description

example

gtLabel = selectLabelsByGroup(gTruth,labelGroups) selects ground truth data with the specified label group names labelGroups 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 multiple labels of groups, types and names.

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

Inspect the label definitions. The object contains two label definitions in a 'vehicle' group. Ungrouped labels are in the group named 'None'.

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 in the group 'Vehicle' group.

groupNames = 'vehicle';
gtLidarLabel = selectLabelsByGroup(lidarLabelerGTruth,groupNames)
gtLidarLabel = 

  groundTruthLidar with properties:

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

View the labels returned by the function.

gtLidarLabel.LabelDefinitions
ans =

  2×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} 

Input Arguments

collapse all

Ground truth lidar data, specified as a groundTruthLidar object or vector of groundTruthLidar objects.

Label group names, specified as a character vector, string scalar, cell array of character vectors, or vector of strings.

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

unique(gTruth.LabelDefinitions.Group)

Example: 'Vehicles'

Example: "Vehicles"

Example: {'Vehicles','Signs'}

Example: ["Vehicles" "Signs"]

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 the gtLabel output corresponds to a groundTruthLidar object in the gTruth input. The returned objects contain only those labels from the input ground truth objects that are of the label groups specified by the labelGroup input.

Introduced in R2020b