matlab最简单的人脸识别程序

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

运行效果图:%%%%%ReadingofaRGBimagei=imread('face9.jpg');I=rgb2gray(i);BW=im2bw(I);figure,imshow(BW)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%minimisationofbackgroundportion[n1n2]=size(BW);r=floor(n1/10);c=floor(n2/10);x1=1;x2=r;s=r*c;fori=1:10y1=1;y2=c;forj=1:10if(y2=c|y2=9*c)|(x1==1|x2==r*10)loc=find(BW(x1:x2,y1:y2)==0);[op]=size(loc);pr=o*100/s;ifpr=100BW(x1:x2,y1:y2)=0;r1=x1;r2=x2;s1=y1;s2=y2;pr1=0;endimshow(BW);endy1=y1+c;y2=y2+c;endx1=x1+r;x2=x2+r;endfigure,imshow(BW)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%detectionoffaceobjectL=bwlabel(BW,8);BB=regionprops(L,'BoundingBox');BB1=struct2cell(BB);BB2=cell2mat(BB1);[s1s2]=size(BB2);mx=0;fork=3:4:s2-1p=BB2(1,k)*BB2(1,k+1);ifpmx&(BB2(1,k)/BB2(1,k+1))1.8mx=p;j=k;endendfigure,imshow(I);holdon;rectangle('Position',[BB2(1,j-2),BB2(1,j-1),BB2(1,j),BB2(1,j+1)],'EdgeColor','r')

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功