Inserting Bounding Boxes when it is more than two together

조회 수: 7 (최근 30일)
Abdussalam Elhanashi
Abdussalam Elhanashi 2019년 10월 29일
댓글: Dp 2020년 6월 24일
Hi Guys
i would like to get a help for the following code where i want to have apperance of Bounding boxes in image or video when they are more than only 2 bounding boxes or more in same time for object detection
the code is
% 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);

채택된 답변

Ajay Pattassery
Ajay Pattassery 2019년 11월 1일
A simple if condition before displaying the annotation will do
if (size(bboxes,1) > 1)
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
end
  댓글 수: 1
Dp
Dp 2020년 6월 24일
Hi Ajay
this is a really easy solution but could you please tell me that how can I change the Font size of the score value (When an object is detected in the frame than it shows the score value like 97.xx so how can I change the font size of this score value). Currently, it's showing me very small in my detection, Hardly see it.
thanks in advance for answering.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tracking and Motion Estimation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by