Main Content

addSublabel

Add sublabel to label in label definition creator object

Description

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 object ldc.

example

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 the info object 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 the info object function.

info(ldc,'TrafficLight')
           Name: "TrafficLight"
           Type: Rectangle
     LabelColor: {''}
          Group: "None"
     Attributes: []
      Sublabels: ["RedLight"    "GreenLight"]
    Description: 'Bounding boxes for traffic light'

Input Arguments

collapse all

Label definition creator, specified as a labelDefinitionCreator object.

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:

  • labelType enumeration — The type of sublabel must be one of these labelType enumerators: Rectangle or Line.

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

  • Character vector or string scalar — This value must partially or fully match one of these labelType enumerators: Rectangle or Line.

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

Note

The labelType enumerators PixelLabel, Scene, and Custom are not supported as values for the type of sublabel in labeling apps.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

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.

Version History

Introduced in R2018b