sobelcolck.m
上传用户:jiaji168
上传日期:2016-05-12
资源大小:816k
文件大小:1k
- I=imread('CLOCK.bmp');
- I=im2double(I);
- %figure;
- %imshow(I);title('org img');
- [height width R]=size(I);
- %Dx=[-1 -2 -1
- %0 0 0
- %1 2 1];
- %Dy=[-1 0 1
- %-2 0 2
- %-1 0 1];
- for i=2:height-1
- for j=2:width-1
- Dx=[I(i+1,j-1)-I(i-1,j-1)]+2*[I(i+1,j)-I(i-1,j)]+[I(i+1,j+1)-I(i-1,j+1)];
- Dy=[I(i-1,j+1)-I(i-1,j-1)]+2*[I(i,j+1)-I(i,j-1)]+[I(i+1,j+1)-I(i+1,j-1)];
- S(i,j)=sqrt(Dx^2+Dy^2);
-
- end
- end
- %figure;
- %imshow(S);
- for i=1:height-1
- for j=1:width-1
- if (S(i,j)<0.6)
- S(i,j)=1;
- else S(i,j)=0;
- end
- end
- end
- figure;
- imshow(S,[]);