Inserting Bounding Boxes when it is more than two together

4 visualizaciones (últimos 30 días)
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);

Respuesta aceptada

Ajay Pattassery
Ajay Pattassery el 1 de Nov. de 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 comentario
Dp
Dp el 24 de Jun. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Tracking and Motion Estimation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by