- I=imread('SEM.bmp');
- I=im2double(I);
- %figure;
- %imshow(I);title('org img');
- [height width R]=size(I);
- for i=2:height-1
- for j=2:width-1
- R(i,j)=abs(I(i+1,j+1)-I(i,j))+abs(I(i+1,j)-I(i,j+1));
- end
- end
- %figure;
- %imshow(R,[]);
- for i=1:height-1
- for j=1:width-1
- if (R(i,j)<0.3)
- R(i,j)=1;
- else R(i,j)=0;
- end
- end
- end
- figure;
- imshow(R,[]);