フィルターのクリア

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

3 ビュー (過去 30 日間)
Avinash S
Avinash S 2016 年 2 月 25 日
回答済み: Image Analyst 2017 年 10 月 3 日
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

回答 (1 件)

Image Analyst
Image Analyst 2017 年 10 月 3 日
Use the rectangle() function:
hold on
rectangle('Position', [xLeft, yTop, width, height]);

カテゴリ

Help Center および File ExchangeVehicle Scenarios についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by