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

图形图像处理

开发平台:

Matlab

  1. I=imread('lena.bmp');
  2. I=im2double(I);
  3. figure;
  4. imshow(I);title('org img');
  5. [height width R]=size(I);
  6. for i=2:height-1
  7.     for j=2:width-1
  8.         R(i,j)=abs(I(i+1,j+1)-I(i,j))+abs(I(i+1,j)-I(i,j+1));
  9.     end
  10. end
  11. figure;
  12. imshow(R,[]);
  13. for i=1:height-1
  14.     for j=1:width-1
  15.         if (R(i,j)<0.25)
  16.             R(i,j)=1;
  17.         else R(i,j)=0;
  18.         end
  19.     end
  20. end
  21. figure;
  22. imshow(R,[]);