1 cl; 2 img=imread('1.bmp'); 3 img=double(img); 4 imshow(mat2gray(img)); 5 6 [m n]=size(img); 7 imgn=zeros(m-3,n-3); 8 temp=[]; 9 for i=1:m-3 10 for j=1:n-3 11 temp=img(i:i+3,j:j+3); 12 imgn(i,j)=median(temp(:)); 13 end 14 end 15 16 figure,imshow(mat2gray(imgn)) 17 imgn=img(1:m-3,1:n-3)-imgn; 18 figure,imshow(mat2gray(imgn)) 19 imgn=imgn .* (imgn>0); 20 figure,imshow(mat2gray(abs(imgn)))