使用matlab检测并计算图像中的人数

时间:2017-01-15 04:27:48

标签: algorithm matlab image-processing

使用 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));

1 个答案:

答案 0 :(得分:0)

您可以使用另一个众所周知的算法来使用HOG和svm进行行人检测。 查看以下Matlab教程。 https://www.mathworks.com/help/vision/ref/vision.peopledetector-class.html