Main Content

addSublabel

Add sublabel to label in label definition creator object

Description

example

addSublabel(ldc,labelName,sublabelName,typeOfSublabel)adds a sublabel with the specified name and type to the indicated label. The sublabel is added under the hierarchy for the specified label in the label definition creator objectldc.

addSublabel(___,Name,Value)specifies options using one or more name-value arguments in addition to the input arguments in the previous syntax.

Examples

collapse all

Load an existing label definitions table into the workspace.

load('labelDefsTable.mat')

Create a label definition creator object from the label definitions table.

ldc = labelDefinitionCreator(labelDefs)
ldc = labelDefinitionCreator contains the following labels: Car with 0 sublabels and 0 attributes and belongs to None group. (info) TrafficLight with 0 sublabels and 0 attributes and belongs to None group. (info) For more details about attributes and sublabels, use the info method.

Add sublabel "Wheel" to the label "Car". Specify the label type for sublabel as a rectangle and add description to the sublabel.

addSublabel(ldc,'Car','Wheel', labelType。Rectangle,'Description','Bounding box for the wheel')

Add sublabels "RedLight" and "GreenLight" to the label "TrafficLight". Specify the label type for the sublabels as rectangle.

addSublabel(ldc,'TrafficLight','RedLight', labelType。Rectangle) addSublabel(ldc,'TrafficLight','GreenLight', labelType。Rectangle)

Display the details of the label definition creator object.

ldc
ldc = labelDefinitionCreator contains the following labels: Car with 1 sublabels and 0 attributes and belongs to None group. (info) TrafficLight with 2 sublabels and 0 attributes and belongs to None group. (info) For more details about attributes and sublabels, use the info method.

Display information about the sublabels under the label "Car" using theinfoobject function.

info(ldc,'Car')
Name: "Car" Type: Rectangle LabelColor: {''} Group: "None" Attributes: [] Sublabels: "Wheel" Description: 'Bounding box for car'

Display information about the sublabels under the label "TrafficLight" using theinfoobject function.

info(ldc,'TrafficLight')
名称:“TrafficLight”类型:矩形LabelColor: {''} Group: "None" Attributes: [] Sublabels: ["RedLight" "GreenLight"] Description: 'Bounding boxes for traffic light'

Input Arguments

collapse all

Label definition creator, specified as alabelDefinitionCreatorobject.

Label name, specified as a character vector or string scalar that uniquely identifies the label to which the sublabel is associated.

Sublabel name, specified as a character vector or string scalar that identifies the sublabel to be added.

Type of sublabel, specified as one of these values:

  • labelTypeenumeration — The type of sublabel must be one of theselabelTypeenumerators:RectangleorLine.

Example:addSublabel(ldc,'Car','Wheel',labelType.Rectangle)

  • Character vector or string scalar — This value must partially or fully match one of theselabelTypeenumerators:RectangleorLine.

Example:addSublabel(ldc,'Car','Wheel','Rec')

Note

ThelabelTypeenumeratorsPixelLabel,Scene, andCustomare not supported as values for the type of sublabel in labeling apps.

Name-Value Pair Arguments

Specify optional comma-separated pairs ofName,Valuearguments.Nameis the argument name andValueis the corresponding value.Namemust appear inside quotes. You can specify several name and value pair arguments in any order asName1,Value1,...,NameN,ValueN.

Example:addSublabel(ldc,'Car','Wheel','Rect','Description','Bounding box for Wheel');

Sublabel description, specified as a comma-separated pair consisting of'Description'and a character vector or string scalar. Use this name-value pair to describe the sublabel.

Introduced in R2018b