priwittclock.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);
- for i=2:height-1
- for j=2:width-1
- Dx=[I(i+1,j-1)-I(i-1,j-1)]+[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)]+[I(i,j+1)-I(i,j-1)]+[I(i+1,j+1)-I(i+1,j-1)];
- P(i,j)=sqrt(Dx^2+Dy^2);
-
- end
- end
- %figure;
- %imshow(P,[]);
- for i=1:height-1
- for j=1:width-1
- if (P(i,j)<0.4)
- P(i,j)=1;
- else P(i,j)=0;
- end
- end
- end
- figure;
- imshow(P,[]);