addSublabel
Add sublabel to label in label definition creator object
Description
addSublabel(
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
,labelName
,sublabelName
,typeOfSublabel
)ldc
.
addSublabel(___,
specifies options using one or more name-value arguments in addition to the input arguments
in the previous syntax.Name,Value
)
Examples
Add Sublabels to Labels in Label Definition Creator Object
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
ldc
— Label definition creator
labelDefinitionCreator
object
Label definition creator, specified as a labelDefinitionCreator
object.
labelName
— Label name
character vector | string scalar
Label name, specified as a character vector or string scalar that uniquely identifies the label to which the sublabel is associated.
sublabelName
— Sublabel name
character vector | string scalar
Sublabel name, specified as a character vector or string scalar that identifies the sublabel to be added.
typeOfSublabel
— Type of sublabel
labelType
enumeration | character vector | string scalar
Type of sublabel, specified as one of these values:
labelType
enumeration — The type of sublabel must be one of theselabelType
enumerators:Rectangle
orLine
.
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
orLine
.
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');
Description
— Sublabel description
' '
(default) | character vector | string scalar
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
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)