Inserting Bounding Boxes when it is more than two together
3 views (last 30 days)
Show older comments
Abdussalam Elhanashi
on 29 Oct 2019
Commented: Dp
on 24 Jun 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);
0 Comments
Accepted Answer
Ajay Pattassery
on 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 Comment
Dp
on 24 Jun 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.
More Answers (0)
See Also
Categories
Find more on Feature Detection and Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!