Main Content

checkLabelDefinition

Class: lidar.labeler.AutomationAlgorithm
Namespace: lidar.labeler

Validate label definition

Since R2022a

Description

In the Lidar Labeler app, the checkLabelDefinition method checks whether each label defined in the ROI Labels and Scene Labels panes is valid. The method restricts an automation algorithm to use only relevant labels. For example, a label definition of type Cuboid cannot be used to mark a lane boundary.

Clients of AutomationAlgorithm must implement this method.

example

isValid = checkLabelDefinition(algObj,labelDef) returns true for valid label definitions and false for invalid definitions for the automation algorithm provided by algObj. labelDef is a structure containing all the label definitions in the ROI Labels and Scene Labels panes. Definitions that return false are disabled during automation.

Examples

expand all

This implementation of the checkLabelDefinition method designates ROI labels such as Cuboid and Line as valid and all other labels as invalid.

function isValid = checkLabelDefinition(algObj,labelDef)
    isValid = isROI(labelDef.Type);
end

This implementation of the checkLabelDefinition method designates Cuboid labels as valid and all other labels as invalid.

function isValid = checkLabelDefinition(algObj,labelDef)
     isValid = (labelDef.Type == labelType.Cuboid);
end

Input Arguments

expand all

Automation algorithm, specified as a lidar.labeler.AutomationAlgorithm object.

Label definition, specified as a structure containing Type and Name fields.

FieldDescription
Type

labelType enumeration that contains the type of label definition. Valid label types are:

  • labelType.Cuboid

  • labelType.Line

  • labelType.Scene

lidarLabelType object contains the label type for voxel labeled ROI. You define the label using lidarLabelType.Voxel.

NameCharacter vector that contains the name of the label definition.

To view a sample labelDef structure that contains a cuboid label definition, enter this code at the MATLAB® command prompt.

labelDef(1).Type = labelType.Cuboid;
labelDef(1).Name = 'Car';

Output Arguments

expand all

True or false result of the label definition validity check, returned as a 1 or 0 of data type logical.

Tips

  • To access the selected label definitions, use the SelectedLabelDefinitions property of the automation algorithm. In the Lidar Labeler app, the selected label definitions are highlighted in yellow in the ROI Labels and Scene Labels panes on the left.

Version History

Introduced in R2022a