Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% 1
- clc
- clear all
- close all
- A=zeros(128,128);
- A(3:4:128,:)=1;
- A(4:4:128,:)=1;
- F=fftshift(fft2(A));
- subplot(2,1,1)
- imshow(A)
- title('oryginal')
- subplot(2,1,2)
- imshow(log(1+abs(F)));
- title ('w. amplitudowe')
- %% 2
- clc
- clear all
- close all
- A=zeros(32,32);
- A(13:18,6:26)=1;
- F=fftshift(fft2(A));
- F2=fftshift(fft2(A,256,256));
- subplot(3,1,1)
- imshow(A)
- title('oryg.')
- subplot(3,1,2)
- imshow(log(1+abs(F)));
- title ('transformata')
- subplot(3,1,3)
- imshow(log(1+abs(F2)));
- title('transformata 2')
- %% 3
- clc
- clear all
- close all
- I=imread('Clown.tif');
- I2=double(I)/255;
- F=fftshift(fft2(I2));
- figure(1)
- subplot(3,1,1)
- imshow(I)
- title('oryginał')
- subplot(3,1,2)
- imshow(log10(1+abs(F)))
- title ('w. amp. log10')
- subplot(3,1,3)
- imshow(angle(F))
- title('w.fazowe')
- %% 4
- clc
- clear all
- close all
- I=imread('Road.tif');
- I2=double(I)/255;
- F=fftshift(fft2(I2));
- I3=ifft2(ifftshift(F));
- I4=imsubtract(I3,I2);
- figure(1)
- subplot(2,1,1)
- imshow(log(1+abs(F)))
- title('w.amplitudowe')
- subplot(212)
- imshow(abs(F).^2)
- title ('w.mocy')
- figure(2)
- subplot(3,1,1)
- imshow(I2)
- title('oryginalny')
- subplot(3,1,2)
- imshow(I3)
- title('odtworzony')
- subplot (3,1,3)
- imshow(I4)
- title('roznica')
- %% 5
- clc
- clear all
- close all
- org=imread('Road.tif');
- orgd = double(org)/255;
- ftorg=fftshift(fft2(orgd));
- fi1=ftorg;
- fi2=ftorg;
- a=60;
- b=150;
- %filtr gornooprzepustowy
- fi1(195-a/2:192+a/2,195-a/2:192+a/2)=0;
- fi1(175:215,175:215)=0;
- ft1=ifft2(ifftshift(fi1));
- %filtr dolnooprzepustowy
- fi2([1:b,(390-b):390],:)=0;
- fi2(:,[1:b,(390-b):390])=0;
- ft2=ifft2(ifftshift(fi2));
- figure(1)
- subplot(231)
- imshow(org)
- title('oryginal')
- subplot(234)
- imshow(log(1+abs(ftorg)));
- title('widmo amplitudowe normalne ');
- subplot(232)
- imshow(ft1);
- title('gorno');
- subplot(233)
- imshow(ft2);
- title('dolno');
- subplot(235)
- imshow(log(1+abs(fi1)));
- title('filtr gorno');
- subplot(236)
- imshow(log(1+abs(fi2)));
- title('filtr dolno');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement