文件名称:matlab边缘检测程序
文件大小:1KB
文件格式:NONE
更新时间:2014-05-29 09:31:38
边缘 检测
matlab 边缘检测程序 =imread('rice.png'); subplot(2,2,1); imshow(I); J = imnoise(I,'gaussian');; subplot(2,2,2); imshow(J); [m,n]=size(J); K=J; h1=[1,2,1;2,4,2;1,2,1]/16; h2=[1,1,1;1,1,1;1,1,1]/9; for i=2:m-1; for j=2:n-1 J(i,j)=h1(1)*J(i-1,j-1)+h1(2)*J(i-1,j)+h1(3)*J(i-1,j+1)+h1(4)*J(i,j-1)+h1(5)*J(i,j)+h1(6)*J(i,j+1)+h1(7)*J(i+1,j-1)+h1(8)*J(i+1,j)+h1(9)*J(i+1,j+1); if J(i,j)>255 J(i,j)=255; elseif J(i,j)<0 J(i,j)=abs(J(i,j)); else J(i,j)=double(J(i,j)); end end end subplot(2,2,3); imshow(J); for i=2:m-1;