- <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>
matlab自带的分类器对人脸、鼻子、嘴进行检测
最新推荐文章于 2023-01-01 19:52:28 发布