当两个以上在一起时插入边界框

时间:2019-10-30 10:14:32

标签: bounding-box

我想获得以下代码的帮助,当我希望图像或视频中的边界框同时超过2个或更多边界框用于对象检测时,我希望它们具有外观 代码是

% PROCESS
    [bboxes, scores, label] = detect(detector,I,'MiniBatchSize', 128);

 % Select strongest detection 
% New - Find those bounding boxes that surpassed a threshold
T = 0.50; % Define threshold here
idx = scores >= T;
% Retrieve those scores that surpassed the threshold
s = scores(idx);
% Do the same for the labels as well
lbl = label(idx);
bboxes = bboxes(idx, :); % This logic doesn't change
for ii = 1 : size(bboxes, 1)
    annotation = sprintf('%s: (Confidence = %f)', lbl(ii), s(ii)); % Change    
    I = insertObjectAnnotation(I, 'rectangle', bboxes(ii,:), annotation); % New - Choose the right box
end
step(vidPlayer,I);
 i = i+1;
end
 results = struct2table(results);
 release(vidPlayer);

0 个答案:

没有答案