Run label automation on every frame in interval


run computes the labels for a single image frame by executing the automation algorithm.

Clients of AutomationAlgorithm must implement this method.

autoLabels = run(algObj,I) processes a single image, I, using the algObj automation algorithm, and returns the automated labels in autoLabels.

Input Arguments

expand all

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

Image frame, specified as a numeric matrix.

Output Arguments

expand all

Labels from automation, returned as one of the following.

  • For algorithms without pixel labels, autoLabels is returned as a table (or struct array) containing these variable (or field) names.

    Variable NameDescription
    TypeEnumeration of class labelType with possible values of Rectangle, Line and Scene.
    NameCharacter vector containing the name of the specified label.

    1-by-4 vector in the format [x,y,w,h] that specifies the position of bounding box locations for the Rectangle labelType.

    N-by-2 vector in the format [x1,y1;x2,y2; . . . xN,yN] that specifies N points along a polyline for the Line labelType.

    [] for Scene labelType.

    Example of an autoLabels table:

            Name          Type         Position  
        ____________    _________    ____________
        'Car'           Rectangle    [1×4 double]
        'LaneMarker'    Line         [3×2 double]
        'Sunny'         Scene        [         1]

    For information on defining a table, see Create autoLabels Table or Structure.

  • For algorithms with pixel labels, autoLabels is returned as a categorical label matrix, where each category represents a pixel label. See How Labeler Apps Store Exported Pixel Labels


Create autoLabels Table or Structure

When you implement the run method for an automation algorithm without pixel labels, you must populate a table or structure with the labels from automation, according to autoLabels. This code demonstrates how to populate a structure array with three elements.

% Rectangle labeled 'Car' positioned with top-left at (20,20)
% with width and height equal to 50.
autoLabels(1).Name = 'Car';
autoLabels(1).Type = labelType('Rectangle');
autoLabels(1).Position = [20 20 50 50];

% Line labeled 'LaneMarker' with 3 points.
autoLabels(2).Name = 'LaneMarker';
autoLabels(2).Type = labelType('Line');
autoLabels(2).Position = [100 100; 100 110; 110 120];

% Scene labeled 'Sunny'
autoLabels(3).Name = 'Sunny';
autoLabels(3).Type = labelType('Scene');
autoLabels(3).Position = true; 

Introduced in R2017a