簡體   English   中英

使用Matlab檢測並計算圖像中的人數

[英]Detect and count the number of people in an image using matlab

使用MatLab對房間中的人數進行計數,但使用Viola-Jones算法無法精確計算。 有人可以幫我嗎?

%Detect objects using Viola-Jones Algorithm

%% CODE FOR PEOPLE COUNT BASED ON FACES
%get the input image

I=imread('DCN.jpg')*2;

imshow(I),title('Image:1'); 


J = rgb2gray(I);

%To detect Face

FDetect = vision.CascadeObjectDetector;


% Returns Bounding Box values based on number of objects

BB = step(FDetect,J);

figure,

%detectedImg = insertObjectAnnotation(J,'rectangle',BB,'stop sign');

%
imshow(J); hold on

for i = 1:size(BB,1)

    rectangle('Position',BB(i,:),'LineWidth',2,'LineStyle','-','EdgeColor','y');
end

title('Face Detection');
hold off;

numberOfBlobs = length(BB);

message = sprintf('Done by  Abhishek.\nThe number of persons = %d', numberOfBlobs);

uiwait(helpdlg(message));

您可以使用HOG和svm將另一種眾所周知的算法用於行人檢測。 查看以下有關Matlab的教程。 https://www.mathworks.com/help/vision/ref/vision.peopledetector-class.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM