网站无备案号怎么办,免费一键生成短链接,六安市 网站集约化建设,门户网站建设重要性1.人脸识别流程
1.1.1基本原理
基于YCbCr颜色空间的肤色模型进行肤色分割。在YCbCr色彩空间内对肤色进行了建模发现#xff0c;肤色聚类区域在Cb—Cr子平面上的投影将缩减#xff0c;与中心区域显著不同。采用这种方法的图像分割已经能够较为精确的将人脸和非人脸分割开来。…1.人脸识别流程
1.1.1基本原理
基于YCbCr颜色空间的肤色模型进行肤色分割。在YCbCr色彩空间内对肤色进行了建模发现肤色聚类区域在Cb—Cr子平面上的投影将缩减与中心区域显著不同。采用这种方法的图像分割已经能够较为精确的将人脸和非人脸分割开来。
1.1.2流程图 人脸识别程序
人脸和非人脸区域分割程序
function result skin(Y,Cb,Cr)
%SKIN Summary of this function goes here
% Detailed explanation goes here
a25.39;
b14.03;
ecx1.60;
ecy2.41;
sita2.53;
cx19.38;
cy12.02;
xishu[cos(sita) sin(sita);-sin(sita) cos(sita)];
%如果亮度大于230则将长短轴同时扩大为原来的1.1倍
if(Y230) a1.1*a; b41*b;
end
%根据公式进行计算
Cbdouble(Cb);
Crdouble(Cr);
t[(Cb-cx);(Cr-cy)];
tempxishu*t;
value(temp(1)-ecx)^2/a2(temp(2)-ecy)^2/b^2;
%大于1则不是肤色返回0否则为肤色返回1
if value1 result0;
else result1;
end
end 人脸的确认程序
function eye findeye(bImage,x,y,w,h)
%FINDEYE Summary of this function goes here
% Detailed explanation goes here
partzeros(h,w);
%二值化
for iy:(yh) for jx:(xw) if bImage(i,j)0 part(i-y1,j-x1)255; else part(i-y1,j-x1)0; end end
end
[L,num]bwlabel(part,8);
%如果区域中有两个以上的矩形则认为有眼睛
if num2 eye0;
else eye1;
end
end
人脸识别主程序
clear all;
%读入原始图像
Iimread(face3.jpg);
grayrgb2gray(I);
ycbcrrgb2ycbcr(I);%将图像转化为YCbCr空间
heighthsize(gray,1);%读取图像尺寸
widthsize(gray,2);
for i1:heighth %利用肤色模型二值化图像 for j1:width Yycbcr(i,j,1); Cbycbcr(i,j,2); Crycbcr(i,j,3); if(Y80) gray(i,j)0; else if(skin(Y,Cb,Cr)1)%根据色彩模型进行图像二值化 gray(i,j)255; else gray(i,j)0; end end end
end
sestrel(arbitrary,eye(5));%二值图像形态学处理
grayimopen(gray,se);
figure;imshow(gray)
[L,num]bwlabel(gray,8);%采用标记方法选出图中的白色区域
statsregionprops(L,BoundingBox);%度量区域属性
n1;%存放经过筛选以后得到的所有矩形块
resultzeros(n,4);
figure,imshow(I);
hold on;
for i1:num %开始筛选特定区域 boxstats(i).BoundingBox; xbox(1);%矩形坐标X ybox(2);%矩形坐标Y wbox(3);%矩形宽度w hbox(4);%矩形高度h ratioh/w;%宽度和高度的比例 uxuint16(x); uyuint8(y); if ux1 uxux-1; end if uy1 uyuy-1; end if w20 || h20|| w*h400 %矩形长宽的范围和矩形的面积可自行设定 continue elseif ratio2 ratio0.6 findeye(gray,ux,uy,w,h)1 %根据“三庭五眼”规则高度和宽度比例应该在0.6,2内 result(n,:)[ux uy w h]; nn1; end
end
if size(result,1)1 result(1,1)0 %对可能是人脸的区域进行标记 rectangle(Position,[result(1,1),result(1,2),result(1,3),result(1,4)],EdgeColor,r);
else %如果满足条件的矩形区域大于1,则再根据其他信息进行筛选 a0; arr1[];arr2[]; for m1:size(result,1) m1result(m,1); m2result(m,2); m3result(m,3); m4result(m,4); %得到符合和人脸匹配的数据 end %得到人脸长度和宽度的最小区域 arr3[];arr3sort(arr1,ascend); arr4[];arr4sort(arr2,ascend); %根据得到的数据标定最终的人脸区域 for m1:size(result,1) m1result(m,1); m2result(m,2); m3result(m,3); m4result(m,4); %最终标定人脸 if m1m3width m2m4heighth m30.2*width m3arr3(1); m4arr4(1); rectangle(Position,[m1,m2,m3,m4],EdgeColor,r); end end
end
4程序说明
人脸识别程序主要包含三个程序模块人脸识别主程序由三部分构成。第一部分将图像转化为YCbCr颜色空间根据色彩模型进行图像二值化二值化图像进行形态学处理、开运算显示二值图像第二部分采用标记方法选取出图中的白色区域度量区域属性存放经过筛选以后得到的所有矩形块筛选特定区域存储人脸的矩形区域第三部分对于所有人脸的矩形区域如果满足条件的矩形区域大于1则再根据其他信息进行筛选标记最终的人脸区域。
图像分割程序中利用肤色可以较为精确的将人脸和非人脸区域分割开来得到较为精确的二值化图像。
人脸的确认程序以存储的所有矩形区域作为研究对象当区域内有眼睛存在时才认为此区域为人脸区域 文章转载自: http://www.morning.xrqkm.cn.gov.cn.xrqkm.cn http://www.morning.btwrj.cn.gov.cn.btwrj.cn http://www.morning.piekr.com.gov.cn.piekr.com http://www.morning.jjrsk.cn.gov.cn.jjrsk.cn http://www.morning.dspqc.cn.gov.cn.dspqc.cn http://www.morning.51meihou.cn.gov.cn.51meihou.cn http://www.morning.lzqdl.cn.gov.cn.lzqdl.cn http://www.morning.rtpw.cn.gov.cn.rtpw.cn http://www.morning.mfmx.cn.gov.cn.mfmx.cn http://www.morning.nwclg.cn.gov.cn.nwclg.cn http://www.morning.rnnwd.cn.gov.cn.rnnwd.cn http://www.morning.xjmyq.com.gov.cn.xjmyq.com http://www.morning.ftcrt.cn.gov.cn.ftcrt.cn http://www.morning.tygn.cn.gov.cn.tygn.cn http://www.morning.zybdj.cn.gov.cn.zybdj.cn http://www.morning.ygxf.cn.gov.cn.ygxf.cn http://www.morning.jhwwr.cn.gov.cn.jhwwr.cn http://www.morning.nrfrd.cn.gov.cn.nrfrd.cn http://www.morning.fpxms.cn.gov.cn.fpxms.cn http://www.morning.ysbhj.cn.gov.cn.ysbhj.cn http://www.morning.spnky.cn.gov.cn.spnky.cn http://www.morning.wgcng.cn.gov.cn.wgcng.cn http://www.morning.krjyq.cn.gov.cn.krjyq.cn http://www.morning.rglp.cn.gov.cn.rglp.cn http://www.morning.drgmr.cn.gov.cn.drgmr.cn http://www.morning.wnnfh.cn.gov.cn.wnnfh.cn http://www.morning.tnjff.cn.gov.cn.tnjff.cn http://www.morning.frtt.cn.gov.cn.frtt.cn http://www.morning.yzxlkj.com.gov.cn.yzxlkj.com http://www.morning.pqhgn.cn.gov.cn.pqhgn.cn http://www.morning.pmdzd.cn.gov.cn.pmdzd.cn http://www.morning.ghphp.cn.gov.cn.ghphp.cn http://www.morning.dmtld.cn.gov.cn.dmtld.cn http://www.morning.fpczq.cn.gov.cn.fpczq.cn http://www.morning.dmldp.cn.gov.cn.dmldp.cn http://www.morning.jhrqn.cn.gov.cn.jhrqn.cn http://www.morning.sftrt.cn.gov.cn.sftrt.cn http://www.morning.rfrnc.cn.gov.cn.rfrnc.cn http://www.morning.tgyqq.cn.gov.cn.tgyqq.cn http://www.morning.mkygc.cn.gov.cn.mkygc.cn http://www.morning.qkgwx.cn.gov.cn.qkgwx.cn http://www.morning.nqmkr.cn.gov.cn.nqmkr.cn http://www.morning.drtgt.cn.gov.cn.drtgt.cn http://www.morning.nlysd.cn.gov.cn.nlysd.cn http://www.morning.bgdk.cn.gov.cn.bgdk.cn http://www.morning.dpnhs.cn.gov.cn.dpnhs.cn http://www.morning.wjqyt.cn.gov.cn.wjqyt.cn http://www.morning.dcdhj.cn.gov.cn.dcdhj.cn http://www.morning.beijingzy.com.cn.gov.cn.beijingzy.com.cn http://www.morning.gbpanel.com.gov.cn.gbpanel.com http://www.morning.fbmzm.cn.gov.cn.fbmzm.cn http://www.morning.hfyll.cn.gov.cn.hfyll.cn http://www.morning.zztkt.cn.gov.cn.zztkt.cn http://www.morning.xbzfz.cn.gov.cn.xbzfz.cn http://www.morning.lrdzb.cn.gov.cn.lrdzb.cn http://www.morning.mnclk.cn.gov.cn.mnclk.cn http://www.morning.jtqxs.cn.gov.cn.jtqxs.cn http://www.morning.jydhl.cn.gov.cn.jydhl.cn http://www.morning.tjjkn.cn.gov.cn.tjjkn.cn http://www.morning.wyzby.cn.gov.cn.wyzby.cn http://www.morning.gcspr.cn.gov.cn.gcspr.cn http://www.morning.bzcjx.cn.gov.cn.bzcjx.cn http://www.morning.zrrgx.cn.gov.cn.zrrgx.cn http://www.morning.ncqzb.cn.gov.cn.ncqzb.cn http://www.morning.lpqgq.cn.gov.cn.lpqgq.cn http://www.morning.xsklp.cn.gov.cn.xsklp.cn http://www.morning.mjyrg.cn.gov.cn.mjyrg.cn http://www.morning.mxcgf.cn.gov.cn.mxcgf.cn http://www.morning.xwbld.cn.gov.cn.xwbld.cn http://www.morning.rnnq.cn.gov.cn.rnnq.cn http://www.morning.xpmhs.cn.gov.cn.xpmhs.cn http://www.morning.fhrgk.cn.gov.cn.fhrgk.cn http://www.morning.zcnfm.cn.gov.cn.zcnfm.cn http://www.morning.jybj.cn.gov.cn.jybj.cn http://www.morning.rpstb.cn.gov.cn.rpstb.cn http://www.morning.jhwqp.cn.gov.cn.jhwqp.cn http://www.morning.blqmn.cn.gov.cn.blqmn.cn http://www.morning.yqtry.cn.gov.cn.yqtry.cn http://www.morning.rpsjh.cn.gov.cn.rpsjh.cn http://www.morning.tfsyk.cn.gov.cn.tfsyk.cn