Guest User

Untitled

a guest
Feb 20th, 2015
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.67 KB | None | 0 0
  1. clear all;
  2. close all;
  3. clc
  4.  
  5. Image = imread('Lenna.png');
  6. %Image = imread('k.jpg');
  7. Gray = rgb2gray(Image);
  8. GrayFFT = fft(Gray);
  9. dim = length (GrayFFT);
  10. sample = zeros(3);
  11.  
  12. mask = [ 0,-1, 0;
  13.         -1, 4,-1;
  14.          0,-1, 0];
  15.      
  16. %co tu powinno być?
  17. Masked = Gray;
  18.  
  19. for row = 2:dim -1
  20.     for col = 2:dim-1
  21.     sample = GrayFFT((row-1):(row+1),(col-1):(col+1));
  22.     sample = sample .* mask;
  23.     Masked(row,col) = sum(sum(sample));  
  24.     end
  25. end;
  26.  
  27. Out = ifft(Masked);
  28.  
  29. imwrite(real(Out),'Out.png');
  30.  
  31. imshow(real(Out), [real(min(Out(:))) real(max(Out(:)))] );
  32.  
  33. % Comparison = [Gray,Out];
  34. % imwrite(Comparison,'Comparison.png');
  35. % imshow(Comparison);
Advertisement
Add Comment
Please, Sign In to add comment