Advertisement
KDOXG

transform_freq

Nov 15th, 2020
3,091
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.49 KB | None | 0 0
  1. function img_transform = transform_freq(imagem, s)
  2.   #img_transform = "";
  3.   img_transform = [];
  4.   if s != 0 && s != 1
  5.     return
  6.   endif
  7.   #Im = imread(imagem);
  8.   Im = imagem;
  9.   if s == 0
  10.     Im = im2double(Im);
  11.     Im = fft2(Im);
  12.     Im = fftshift(Im);
  13.     #Im = log(abs(Im));
  14.   else
  15.     Im = ifftshift(Im);
  16.     Im = ifft2(Im);
  17.     Im = abs(Im);
  18.     #Im = uint8(Im);
  19.   endif
  20.   imwrite(Im,"result.bmp");
  21.   #img_transform = "result.png";
  22.   img_transform = Im;
  23.   return
  24. endfunction
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement