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 Center および File ExchangeTracking and Motion Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by