Main Content

checkLabelDefinition

Class:vision.labeler.AutomationAlgorithm
Package:vision.labeler

Validate label definition

Description

In the labeling apps, thecheckLabelDefinitionmethod checks whether each label defined in theROI LabelsandScene Labelspanes is valid. The method restricts an automation algorithm to use only relevant labels. For example, a label definition of typeRectanglecannot be used to mark a lane boundary.

Clients ofAutomationAlgorithmmust implement this method.

isValid= checkLabelDefinition(algObj,labelDef)returnstruefor valid label definitions andfalsefor invalid definitions for the automation algorithm provided byalgObj.labelDefis a structure containing all the label definitions in theROI LabelsandScene Labelspanes. Definitions that returnfalseare disabled during automation.

Examples

expand all

This implementation of thecheckLabelDefinitionmethod designatesRectanglelabels as valid and all other labels as invalid.

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

This implementation of thecheckLabelDefinitionmethod designates ROI labels such asRectangleandLineas valid and all other labels as invalid.

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

Input Arguments

expand all

Automation algorithm, specified as avision.labeler.AutomationAlgorithmobject.

Label definition, specified as a structure containingTypeandNamefields.

Field Description
Type

labelTypedefini枚举包含类型的标签tion. 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.Customis not supported.

Name Character vector that contains the name of the label definition.

To view a samplelabelDefstructure 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 a1or0of data typelogical.

Tips

  • To access the selected label definitions, use theSelectedLabelDefinitionsproperty of the automation algorithm. In the labeling apps, the selected label definitions are highlighted in yellow in theROI LabelsandScene Labelspanes on the left.

Version History

Introduced in R2017a