人脸检测matlab实现

denglingli 2009-05-05 10:12:43
谁有有人脸检测的matlab实现的原代码呀,做毕设,不知如何开始,希望能参考一下。
...全文
247 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Achillesccj 2009-06-08
  • 打赏
  • 举报
回复
自己找一张包含人脸的照片,取名为face8.jpg
Achillesccj 2009-06-08
  • 打赏
  • 举报
回复
clear all
close all
clc
%%%%% Reading of a RGB image
im=imread('face8.jpg');
figure
imshow(im)
I=rgb2gray(im);
BW=im2bw(I);
figure,imshow(BW)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% minimisation of background portion
[n1 n2]=size(BW);
r=floor(n1/10);
c=floor(n2/10);
x1=1;x2=r;
s=r*c;
for i=1:10
y1=1;y2=c;
for j=1:10
if (y2<=c | y2>=9*c) | (x1==1 | x2==r*10)
loc=find(BW(x1:x2, y1:y2)==0);
[o p]=size(loc);
pr=o*100/s;
if pr<=100
BW(x1:x2, y1:y2)=0;
r1=x1;r2=x2;s1=y1;s2=y2;
pr1=0;
end
imshow(BW);
end
y1=y1+c;
y2=y2+c;
end

x1=x1+r;
x2=x2+r;
end
figure,imshow(BW)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% detection of face object
[L ,num]= bwlabel(BW,8);
BB = regionprops(L, 'BoundingBox');
BB1=struct2cell(BB);
BB2=cell2mat(BB1);
[s1 s2]=size(BB2);
mx=0;
for k=3:4:s2-1
p=BB2(1,k)*BB2(1,k+1);
if p>mx & (BB2(1,k)/BB2(1,k+1))<1.8
mx=p;
j=k;
end
end
figure,imshow(im);
hold on;
rectangle('Position',[BB2(1,j-2),BB2(1,j-1),BB2(1,j),BB2(1,j+1)],'EdgeColor','g' )
Achillesccj 2009-05-07
  • 打赏
  • 举报
回复
关注下

3,423

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 其他开发语言
社区管理员
  • 其他开发语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧