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

<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>

  • 14
    点赞
  • 41
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值