Effacer les filtres
Effacer les filtres

How to put a bounding box over a human silhouette figure?

3 vues (au cours des 30 derniers jours)
Avinash S
Avinash S le 25 Fév 2016
I have used foreground detector to extract the human silhouette and used H,S channels of HSV to get shadow free silhouette. How to put a bounding box over it so that i can track the human?
foregroundDetector = vision.ForegroundDetector('NumGaussians',3,'NumTrainingFrames',10,'LearningRate',0.000001);
foregroundDetector1 = vision.ForegroundDetector('NumGaussians',3,'NumTrainingFrames',10,'LearningRate',0.000001,'InitialVariance',(30/255)^2);
vid = videoinput('winvideo', 1); %select input device
i=1;
DlgH = figure('units','normalized','outerposition',[0 0 1 1]);
H = uicontrol('Style', 'PushButton', ...
'String', 'Close', ...
'Callback', 'delete(gcbf)');
while (ishandle(H))
frame = getsnapshot(vid);
subplot(1,3,1), imshow(frame);
title('frame');
foreground = step(foregroundDetector, frame);
%imshow(foreground);
hsv = rgb2hsv(frame);
hsfore = step(foregroundDetector1, hsv(:,:,1:2));
se = strel('square', 3);
filteredForeground = imopen(foreground, se);
HsfilteredForeground = imopen(hsfore, se);
Res = imdilate (HsfilteredForeground,ones(5));
re = imfill(Res,'holes');
subplot(1,3,3), imshow(re);
title('HS foreground Without shadow');
subplot(1,3,2), imshow(filteredForeground);
title('RGB Foreground');
drawnow
end
close

Réponses (1)

Image Analyst
Image Analyst le 3 Oct 2017
Use the rectangle() function:
hold on
rectangle('Position', [xLeft, yTop, width, height]);

Catégories

En savoir plus sur Vehicle Scenarios 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