blockedImageAutomationAlgorithm
Description
computes labels based on the algorithm you specify in this method. The Image
Labeler app invokes this method on each image you choose for blocked image
automation in the app. res
= blockedImageAutomationAlgorithm(algObj
,bstruct
)algObj
is a
vision.labeler.AutomationAlgorithm
object. bstruct
is a structure. The format of the output, res
, depends on the type of
automation algorithm specified.
Examples
Sample Blocked Image Algorithm Automation Function
Here is an example of a blocked image algorithm automation function.
function res = blockedImageAutomationAlgorithm(algObj,bstruct) % Detect people using aggregate channel features detector = peopleDetectorACF('inria-100x41'); [bboxes, scores] = detect(detector, bstruct.Data,... 'SelectStrongest', false); % Apply non-maximum suppression to select the strongest bounding boxes. [selectedBboxes, selectedScores] = selectStrongestBbox(bboxes, scores,... 'RatioType', 'Min',... 'OverlapThreshold', 0.65); % Consider only detections that meet specified score threshold selectedBboxes = selectedBboxes(selectedScores > 0, :); selectedBboxes(:,1) = selectedBboxes(:,1)+bstruct.Start(2); selectedBboxes(:,2) = selectedBboxes(:,2)+bstruct.Start(1); if algObj.SelectedLabelDefinitions.Type == "Rectangle" % Add the selected label at the bounding box position(s) res = struct(... 'Type', labelType.Rectangle,... 'Name', algObj.SelectedLabelDefinitions.Name,... 'Position', selectedBboxes); end end
Input Arguments
Output Arguments
Tips
For automation algorithms without pixel labels, the
Position
field inres
must be in a world coordinate system. This can be achieved by adding the X and Y indices in thebstruct.Start
field to the output of the automation algorithm. To get the correct X coordinate, addbstruct.Start(2)
to get the position of the automation output in world coordinates. To get the correct Y coordinate, addbstruct.Start(1)
to get the position of the automation output in world coordinates.
Version History
Introduced in R2021a