⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 新建 文本文档.txt

📁 svm的分类和应用~~有详细的例子,非常实际和好用~~
💻 TXT
字号:
%%%%% Reading of a RGB image 
for l=2:8 

l=num2str(l); 
KK=['face' l '.jpg']; 
i=imread(KK); 
I=rgb2gray(i); 
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 = 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(I); 
hold on; 
rectangle('Position',[BB2(1,j-2),BB2(1,j-1),BB2(1,j),BB2(1,j+1)],'EdgeColor','r' ) 
end 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -