Inserting Bounding Boxes when it is more than two together

4 vues (au cours des 30 derniers jours)
Abdussalam Elhanashi
Abdussalam Elhanashi le 29 Oct 2019
Commenté : Dp le 24 Juin 2020
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);

Réponse acceptée

Ajay Pattassery
Ajay Pattassery le 1 Nov 2019
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 commentaire
Dp
Dp le 24 Juin 2020
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Tracking and Motion Estimation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by