wallisclock.m
上传用户:jiaji168
上传日期:2016-05-12
资源大小:816k
文件大小:1k
源码类别:

图形图像处理

开发平台:

Matlab

  1. %Wallis微分算子
  2. clear all;
  3. I=imread('CLOCK.bmp');
  4. %figure
  5. %imshow(I);
  6. I=im2double(I);
  7. [height width R]=size(I);
  8. for i=2:height-1
  9.     for j=2:width-1
  10.         II(i,j)=log10(I(i,j)+1)-0.25*(log10(I(i-1,j)+1)+log10(I(i+1,j)+1)+log10(I(i,j-1)+1)+log10(I(i,j+1)+1));
  11.     end
  12. end
  13. min1=min(II);
  14. min2=min(min1);
  15. for i=2:height-1
  16.    for j=2:width-1
  17.       II(i,j)=46*II(i,j)-min2+0.4;
  18.   end
  19. end
  20. %figure
  21. %imshow(II,[]);
  22. for i=1:height-1
  23.     for j=1:width-1
  24.         if (II(i,j)<-0.035)
  25.            II(i,j)=0;
  26.         else II(i,j)=1;
  27.         end
  28.     end
  29. end
  30. figure;
  31. imshow(II,[]);