数字图像处
2.图像腐蚀算法
H=imread('C:\Users\Administrator\Desktop\zhengqiji.jpg'); H=rgb2gray(H); [M,N]=size(H); G2=H;B2=H; Express=H; bottle=zeros(M,N);
-----------------------图像锐化--------------------------------- for i=2:M-1 for j=2:N-1
GX2=(H(i+1,j-1)+2*H(i+1,j)+H(i+1,j+1))-(H(i-1,j-1)+2*H(i-1,j)+H(i-1,j+1));
GY2=(H(i-1,j+1)+2*H(i,j+1)+H(i+1,j+1))-(H(i-1,j-1)+2*H(i,j-1)+H(i+1,j-1));
G2(i,j)=abs(GX2)+abs(GY2); if G2(i,j)>0 B2(i,j)=1;