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

  1. <span style="font-size:18px;">%%^^^^^^^^^^^^author: jagadeesh  
  2. %%^^^^^^^^^^^mail id: g.jagadeesh458@gmail.com  
  3. %^^^^^^^project: face and noise and eye detection for matlab image  
  4. %processing tool box  
  5. clear all  
  6. clc  
  7. close all  
  8.   
  9. %To detect Face  
  10. FDetect = vision.CascadeObjectDetector;  
  11.   
  12. %Read the input image  
  13. I = imread('E:6.jpg');  
  14.   
  15. %Returns Bounding Box values based on number of objects  
  16. face_dtect = step(FDetect,I);  
  17.   
  18. figure(1),  
  19. imshow(I); hold on  
  20. for i = 1:size(face_dtect,1)  
  21.     rectangle('Position',face_dtect(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','m');  
  22. end  
  23. title('Face Detection');  
  24. hold off;  
  25. for i=1:size(v,2)  
  26. %     z=[z,norm(cv(i,:)-s,2)];  
  27. %     if(rem(i,20)==0),imshow(reshape(v(:,i),112,92)),end;  
  28. %     drawnow;  
  29. % end  
  30. %   
  31. % [a,i]=min(z);  
  32. % subplot(122);  
  33. % imshow(reshape(v(:,i),112,92));title('Found!','FontWeight','bold','Fontsize',16,'color','red');  
  34. %   
  35.   
  36.   
  37. %%%To detect Nose  
  38. NoseDetect = vision.CascadeObjectDetector('Nose','MergeThreshold',16);  
  39.   
  40.   
  41.   
  42. face_dtect=step(NoseDetect,I);  
  43.   
  44.   
  45. figure(2),  
  46. imshow(I); hold on  
  47. for i = 1:size(face_dtect,1)  
  48.     rectangle('Position',face_dtect(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','m');  
  49. end  
  50. title('Nose Detection');  
  51. hold off;  
  52.   
  53.   
  54.   
  55. %To detect Mouth  
  56. mouth_detect = vision.CascadeObjectDetector('Mouth','MergeThreshold',16);  
  57.   
  58. face_dtect=step(mouth_detect,I);  
  59.   
  60.   
  61. figure(3),  
  62. imshow(I); hold on  
  63. for i = 1:size(face_dtect,1)  
  64.  rectangle('Position',face_dtect(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','r');  
  65. end  
  66. title('Mouth Detection');  
  67. hold off;</span>  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值