Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. %% 1
  2. clc
  3. clear all
  4. close all
  5.  
  6. A=zeros(128,128);
  7. A(3:4:128,:)=1;
  8. A(4:4:128,:)=1;
  9. F=fftshift(fft2(A));
  10. subplot(2,1,1)
  11. imshow(A)
  12. title('oryginal')
  13. subplot(2,1,2)
  14. imshow(log(1+abs(F)));
  15. title ('w. amplitudowe')
  16.  
  17. %% 2
  18. clc
  19. clear all
  20. close all
  21.  
  22. A=zeros(32,32);
  23. A(13:1:18,6:1:26)=1;
  24. F=fftshift(fft2(A));
  25. F2=fftshift(fft2(A,256,256));
  26. subplot(3,1,1)
  27. imshow(A)
  28. title('oryg.')
  29. subplot(3,1,2)
  30. imshow(log(1+abs(F)));
  31. title ('transformata')
  32. subplot(3,1,3)
  33. imshow(log(1+abs(F2)));
  34. title('transformata 2')
  35.  
  36. %% 3
  37. clc
  38. clear all
  39. close all
  40.  
  41. I=imread('Clown.tif');
  42. I2=double(I)/255;
  43. F=fftshift(fft2(I2));
  44. figure(1)
  45. subplot(3,1,1)
  46. imshow(I)
  47. title('oryginał')
  48. subplot(3,1,2)
  49. imshow(log10(1+abs(F)))
  50. title ('w. amp. log10')
  51. subplot(3,1,3)
  52. imshow(angle(F))
  53. title('w.fazowe')
  54.  
  55.  
  56. %% 4
  57. clc
  58. clear all
  59. close all
  60.  
  61. I=imread('Road.tif');
  62. I2=double(I)/255;
  63. F=fftshift(fft2(I2));
  64. I3=ifft2(ifftshift(F));
  65. I4=imsubtract(I2,I3);
  66. figure(1)
  67. subplot(2,1,1)
  68. imshow(F)
  69. title('w.amplitudowe')
  70. subplot(212)
  71. imshow(abs(F).^2)
  72. title ('w.mocy')
  73. figure(2)
  74. subplot(3,1,1)
  75. imshow(I2)
  76. title('oryginalny')
  77. subplot(3,1,2)
  78. imshow(I3)
  79. title('odtworzony')
  80. subplot (3,1,3)
  81. imshow(I4)
  82. title('roznica')
  83.  
  84. %% 5
  85. clc
  86. clear all
  87. close all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement