Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.57 KB | None | 0 0
  1. %addpath([pwd], 'util/');
  2. img = imread('raster_schwan.png');
  3.  
  4. for channel = 1:3
  5.     IMG = fftshift(fft2(img(:,:,channel)));
  6.     [sx, sy] = size(IMG);
  7.    
  8.     subplot(2, 2, channel);
  9.     %imshow(abs(IMG) ./ max(abs(IMG)));
  10.  
  11.     sigma = 1.5;
  12.     h = fspecial('gaussian', [sx, sy], sigma);
  13.     H = abs(fftshift(fft2(h)));
  14.    
  15.     %H = zeros(sx, sy);
  16.     %H = fill_circle(H, sx/2, sy/2, 30, 1);
  17.     IMG = IMG .* H;
  18.     imshow(abs(IMG) ./ max(abs(IMG)));
  19.    
  20.     IMG = ifftshift(IMG);
  21.     img(:,:,channel) = uint8(real(ifft2(IMG)));
  22. end
  23.  
  24. subplot(224);
  25. imshow(img);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement