checkSetup

Set up validation (optional)

The checkSetup method checks the validity of the setup when you click Run in the labeling app. If checkSetup returns true, then the setup is valid and the app proceeds to execute the initialize, run, and terminate methods.

Clients of AutomationAlgorithm can optionally implement this method.

Syntax

isReady = checkSetup(algObj)
isReady = checkSetup(algObj,labelsToAutomate)

Description

isReady = checkSetup(algObj) returns true if you completed set up correctly and the automation algorithm algObj can begin execution. Otherwise, checkSetup returns false.

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

Examples

Check Setup for ROI Labels

This example shows how to define a checkSetup method for a client of a temporal automation algorithm. This method determines that an automation algorithm is ready to run if at least one ROI label exists. Note that this method uses a labelsToAutomate argument, which is supported by the Ground Truth Labeler and Video Labeler apps, but not the Image Labeler.

function isReady = checkSetup(algObj,labelsToAutomate)
    
    notEmpty = ~isempty(labelsToAutomate);
        
    hasROILabels = any(labelsToAutomate.Type == labelType.Rectangle);
 
    if notEmpty && hasROILabels
        isReady = true;
    else
        isReady = false;
    end
        
end

Input Arguments

expand all

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

Selected labels (ROI and Scene) that are marked before executing the algorithm, specified as a table with the following variables.

Variable NameDescription
TypeEnumeration of class labelType with possible values of Rectangle, Line and Scene.
NameCharacter vector containing the name of the specified label.
TimeScalar double specifying the time, in seconds, when the label was marked.
Position

Label TypeDescription
Rectangle

Position of bounding box locations, specified as a 1-by-4 vector in the format [x,y,w,h].

LinePoints along a polyline, specified as an N-by-2 vector in the format [x1,y1;x2,y2; . . . xN,yN] for N points.
Scene[]

Example of a labelsToAutomate table:

       Type           Name           Time        Position  
     _________    ____________    _________    ____________
 
     Rectangle    'Car'           0.033333     [1x4 double]
     Line         'LaneMarker'    0.066667     [5x2 double]
     Scene        'Sunny'              0.1     [         0] 

Output Arguments

expand all

Set up validation, returned as true or false.

Introduced in R2017a