Main Content

checkLabelDefinition

Class: vision.labeler.AutomationAlgorithm
Namespace: vision.labeler

Validate label definition

Description

In the labeling apps, 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 Rectangle cannot be used to mark a lane boundary.

Clients of AutomationAlgorithm must implement this method.

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 Rectangle labels as valid and all other labels as invalid.

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

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

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

Input Arguments

expand all

Automation algorithm, specified as a vision.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.Rectangle

  • labelType.Cuboid (for point clouds)

  • labelType.ProjectedCuboid (for image and video data)

  • labelType.Line

  • labelType.PixelLabel

  • labelType.Scene

labelType.Custom is not supported.

NameCharacter vector that contains the name of the label definition.

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

labelDef(1).Type = labelType.Rectangle;
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 labeling apps, the selected label definitions are highlighted in yellow in the ROI Labels and Scene Labels panes on the left.

Version History

Introduced in R2017a