关闭

matlab自带的分类器对人脸、鼻子、嘴进行检测

2600人阅读 评论(1) 收藏 举报
分类:
<span style="font-size:18px;">%%^^^^^^^^^^^^author: jagadeesh
%%^^^^^^^^^^^mail id: g.jagadeesh458@gmail.com
%^^^^^^^project: face and noise and eye detection for matlab image
%processing tool box
clear all
clc
close all

%To detect Face
FDetect = vision.CascadeObjectDetector;

%Read the input image
I = imread('E:6.jpg');

%Returns Bounding Box values based on number of objects
face_dtect = step(FDetect,I);

figure(1),
imshow(I); hold on
for i = 1:size(face_dtect,1)
    rectangle('Position',face_dtect(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','m');
end
title('Face Detection');
hold off;
% for i=1:size(v,2)
%     z=[z,norm(cv(i,:)-s,2)];
%     if(rem(i,20)==0),imshow(reshape(v(:,i),112,92)),end;
%     drawnow;
% end
% 
% [a,i]=min(z);
% subplot(122);
% imshow(reshape(v(:,i),112,92));title('Found!','FontWeight','bold','Fontsize',16,'color','red');
% 


%%%To detect Nose
NoseDetect = vision.CascadeObjectDetector('Nose','MergeThreshold',16);



face_dtect=step(NoseDetect,I);


figure(2),
imshow(I); hold on
for i = 1:size(face_dtect,1)
    rectangle('Position',face_dtect(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','m');
end
title('Nose Detection');
hold off;



%To detect Mouth
mouth_detect = vision.CascadeObjectDetector('Mouth','MergeThreshold',16);

face_dtect=step(mouth_detect,I);


figure(3),
imshow(I); hold on
for i = 1:size(face_dtect,1)
 rectangle('Position',face_dtect(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','r');
end
title('Mouth Detection');
hold off;</span>

3
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:571452次
    • 积分:13401
    • 等级:
    • 排名:第1042名
    • 原创:732篇
    • 转载:324篇
    • 译文:14篇
    • 评论:37条
    最新评论