Add label to label definition creator object
addLabel(
adds a label with the specified name and type to the label definition creator object
ldc
,labelName
,typeOfLabel
)ldc
.
addLabel(___,
specifies
options using one or more name-value arguments in addition to the input arguments in the
previous syntax.Name,Value
)
Create a labelDefinitionCreator.
ldc = labelDefinitionCreator;
Add a label named 'Car'.
addLabel(ldc,'Car',labelType.Rectangle);
Inspect the label.
ldc
ldc = labelDefinitionCreator contains the following labels: Car with 0 sublabels and 0 attributes and belongs to None group. (info) For more details about attributes and sublabels, use the info method.
Add another label named 'StopSign' in a group named 'TrafficSign'. Add a description.
addLabel(ldc,'StopSign','Rectangle','Group','TrafficSign','Description','Bounding boxes for stop signs');
Inspect the labels.
ldc
ldc = labelDefinitionCreator contains the following labels: Car with 0 sublabels and 0 attributes and belongs to None group. (info) StopSign with 0 sublabels and 0 attributes and belongs to TrafficSign group. (info) For more details about attributes and sublabels, use the info method.
Create an empty label definition creator object.
ldc = labelDefinitionCreator
ldc = labelDefinitionCreator
Add label "Vehicle" to the label definition creator object. Specify the type of label as a rectangle.
addLabel(ldc,'Vehicle',labelType.Rectangle)
Add label "StopSign" to the label definition creator object. Specify the type of label as a rectangle and add a description to the label.
addLabel(ldc,'StopSign',labelType.Rectangle,'Description','Bounding boxes for stop signs')
Display the details of the label definition creator object.
ldc
ldc = labelDefinitionCreator contains the following labels: Vehicle with 0 sublabels and 0 attributes and belongs to None group. (info) StopSign with 0 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 label "Vehicle" using the object function info
.
info(ldc,'Vehicle')
Name: "Vehicle" Type: Rectangle LabelColor: {''} Group: "None" Attributes: [] Sublabels: [] Description: ' '
Display information about the label "StopSign" using the object function info
.
info(ldc,'StopSign')
Name: "StopSign" Type: Rectangle LabelColor: {''} Group: "None" Attributes: [] Sublabels: [] Description: 'Bounding boxes for stop signs'
ldc
— Label definition creatorlabelDefinitionCreator
objectLabel definition creator, specified as a labelDefinitionCreator
object.
labelName
— Label nameLabel name, specified as a character vector or string scalar that uniquely identifies the label to be added.
typeOfLabel
— Type of labellabelType
enumeration | character vector | string scalarType of label, specified as one of these values:
labelType
enumeration — You can use any of these
labelType
enumerators
to specify the type of label: Rectangle
,
Line
, PixelLabel
,
Scene
, or Custom
.
Example: addLabel(ldc,'Car',labelType.Rectangle);
Character vector or string scalar — This value must partially or fully
match one of the labelType
enumerators.
Example: addLabel(ldc,'Car','Rec');
Specify optional
comma-separated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
addLabel(ldc,'Car',labelType.Rectangle,'Description','Type of
Vehicle');
'Group'
— Group name' None'
(default) | character vector | string scalarGroup name, specified as a comma-separated pair consisting of
'Group'
and a character vector or string scalar. Use this
name-value pair to specify a name for a group of labels.
'Description'
— Label description' '
(default) | character vector | string scalarLabel 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 label.
You have a modified version of this example. Do you want to open this example with your edits?