Implements the blocked image automation algorithm
computes labels based on the algorithm you specify in this method. TheImage Labelerapp invokes this method on each image you choose for blocked image automation in the app.res
= blockedImageAutomationAlgorithm(algObj
,bstruct
)algObj
is avision.labeler.AutomationAlgorithm
object.bstruct
is a structure. The format of the output,res
, depends on the type of automation algorithm specified.
Here is an example of a blocked image algorithm automation function.
functionres = blockedImageAutomationAlgorithm(algObj,bstruct)% Detect people using aggregate channel featuresdetector = 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 thresholdselectedBboxes = selectedBboxes(selectedScores > 0, :); selectedBboxes(:,1) = selectedBboxes(:,1)+bstruct.Start(2); selectedBboxes(:,2) = selectedBboxes(:,2)+bstruct.Start(1);ifalgObj.SelectedLabelDefinitions.Type =="Rectangle"% Add the selected label at the bounding box position(s)res = struct(。..'Type', labelType.Rectangle,。..'Name', algObj.SelectedLabelDefinitions.Name,。..'Position', selectedBboxes);endend
For automation algorithms without pixel labels, thePosition
field inres
must be in a world coordinate system. This can be achieved by adding theXandYindices in thebstruct.Start
field to the output of the automation algorithm. To get the correctXcoordinate, addbstruct.Start(2)
to get the position of the automation output in world coordinates. To get the correctYcoordinate, addbstruct.Start(1)
to get the position of the automation output in world coordinates.