Main Content


Initialize state for algorithm execution (optional)


The initialize method initializes the state of the automation algorithm before the automation algorithm runs.

Clients of AutomationAlgorithm can optionally implement this method.

initialize(algObj,frame) initializes the state of the algObj automation algorithm using the first frame in the time interval of the data being labeled.

Clients of AutomationAlgorithm must implement this user-defined method.

initialize(algObj,frame,labelsToAutomate) additionally provides a table, labelsToAutomate, that contains labels selected for the automation algorithm to use for labeling. This syntax does not support pixel label automation. In addition, this syntax is available only for time-dependent (temporal) automation algorithms. The Ground Truth Labeler (Automated Driving Toolbox) (requires Automated Driving Toolbox™) and Video Labeler apps support temporal algorithms but the Image Labeler does not. For more information on these types of algorithms, see Temporal Automation Algorithms.

Input Arguments

expand all

Automation algorithm, specified as a vision.labeler.AutomationAlgorithm object.

Frame corresponding to the start of time interval, specified as a numeric matrix for Image signals or a pointCloud object for PointCloud signals.

Labels selected for automation, specified as a table with these columns.

Column NameDescription

labelType enumeration that contains the type of the label. Valid label types are:

  • labelType.Rectangle

  • labelType.Cuboid (Ground Truth Labeler app only)

  • labelType.Line

  • labelType.Scene

labelType.PixelLabel and labelType.Custom are not supported.

NameCharacter vector that contains the name of the label.
TimeScalar of type double that specifies the time, in seconds, when the label was marked.

Location of the label in the frame. The format of this vector depends on the label type.

Label TypePosition Format
Rectangle — Rectangular region of interest (ROI) label

1-by-4 numeric vector of the form [x, y, w, h], where:

  • x and y specify the upper-left corner of the rectangle.

  • w specifies the width of the rectangle, which is the length of the rectangle along the x-axis.

  • h specifies the height of the rectangle, which is the length of the rectangle along the y-axis.

Cuboid — Cuboid ROI label

1-by-9 numeric vector of the form [xctr, yctr, zctr, xlen, ylen, zlen, xrot, yrot, zrot], where:

  • xctr, yctr, and zctr specify the center of the cuboid.

  • xlen, ylen, and zlen specify the length of the cuboid along the x-axis, y-axis, and z-axis, respectively.

  • xrot, yrot, and zrot specify the rotation angles for the cuboid along the x-axis, y-axis, and z-axis, respectively. These angles are clockwise-positive when looking in the forward direction of their corresponding axes.

This figure shows how these values specify the position of a cuboid.

Line — Polyline ROI labelN-by-2 numeric matrix of the form [x1 y1; x2 y2; ... ; xN yN] for N points in the polyline.
Scene — Scene label[]

Each row of the table corresponds to a label selected for automation. This labelsToAutomate table contains a rectangle label, a line label with five points, and a cuboid label.

       Type           Name           Time        Position  
     _________    ____________    _________    ____________
     Rectangle    'Car'           0.033333     [1x4 double]
     Line         'LaneMarker'    0.066667     [5x2 double]
     Cuboid       'Truck'         0.099999     [1x9 double] 

Introduced in R2017a