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

1 visualización (últimos 30 días)
Avinash S
Avinash S el 25 de Feb. de 2016
Respondida: Image Analyst el 3 de Oct. de 2017
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

Respuestas (1)

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

Categorías

Más información sobre Vehicle Scenarios 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