Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.37 KB | None | 0 0
  1. A=imread('cln1.png');
  2. B=rgb2gray(A);
  3.  
  4. C=double(B);
  5.  
  6.  
  7. for i=1:size(C,1)-2
  8.     for j=1:size(C,2)-2
  9.         Gx=((2*C(i+2,j+1)+C(i+2,j)+C(i+2,j+2))-(2*C(i,j+1)+C(i,j)+C(i,j+2)));
  10.         Gy=((2*C(i+1,j+2)+C(i,j+2)+C(i+2,j+2))-(2*C(i+1,j)+C(i,j)+C(i+2,j)));
  11.         B(i,j)=sqrt(Gx.^2+Gy.^2);
  12.      
  13.     end
  14. end
  15.  
  16. subplot(1,2,1);
  17. imshow(A);
  18. subplot(1,2,2);
  19. imshow(B);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement