Filter löschen
Filter löschen

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

3 Ansichten (letzte 30 Tage)
Avinash S
Avinash S am 25 Feb. 2016
Beantwortet: Image Analyst am 3 Okt. 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

Antworten (1)

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

Kategorien

Mehr zu Vehicle Scenarios finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by