Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all;
- clearvars;
- clc;
- obraz = imread('lena.bmp');
- Fobraz = fft2(obraz);
- przesuniecie = fftshift(Fobraz);
- A = log10(abs(Fobraz)+1);
- F = angle(Fobraz.*(A>0.0001));
- figure;
- subplot(1,3,1)
- imshow(obraz);
- subplot(1,3,2);
- imshow(A, []);
- subplot(1,3,3);
- imshow(F, []);
- [f1, f2] = freqspace(512, 'meshgrid');
- Hd = ones(512);
- r = sqrt(f1.^2 + f2.^2);
- Hd((r>0.1)) = 0;
- przefiltrowane = przesuniecie.*Hd;
- i1 = ifftshift(przefiltrowane);
- i2 = ifft2(i1);
- figure;
- subplot(1,3,1);
- imshow(obraz);
- subplot(1,3,2);
- imshow(uint8(i2), []);
- subplot(1,3,3);
- imshow(imsubtract(obraz,uint8(i2)),[]);
- [f1, f2] = freqspace(512, 'meshgrid');
- Hd = ones(512);
- r = sqrt(f1.^2 + f2.^2);
- Hd((r<0.1)) = 0;
- przefiltrowane = przesuniecie.*Hd;
- i1 = ifftshift(przefiltrowane);
- i2 = ifft2(i1);
- figure;
- subplot(1,3,1);
- imshow(obraz);
- subplot(1,3,2);
- imshow(uint8(i2), []);
- subplot(1,3,3);
- imshow(imsubtract(obraz,uint8(i2)),[]);
- [f1, f2] = freqspace(512, 'meshgrid');
- Hd = ones(512);
- r = sqrt(f1.^2 + f2.^2);
- Hd(((r>0.4)&(r<0.6))) = 0; % exp
- przefiltrowane = przesuniecie.*Hd;
- i1 = ifftshift(przefiltrowane);
- i2 = ifft2(i1);
- figure;
- subplot(1,3,1);
- imshow(obraz);
- subplot(1,3,2);
- imshow(uint8(i2), []);
- subplot(1,3,3);
- imshow(imsubtract(obraz,uint8(i2)),[]);
- [f1, f2] = freqspace(512, 'meshgrid');
- Hd = ones(512);
- r = sqrt(f1.^2 + f2.^2);
- Hd((r>0.1)) = 0;
- h = fwind1(Hd, hanning(21));
- [H, f1, f2] = freqz2(h, 512, 512);
- przefiltrowane = przesuniecie.*H;
- i1 = ifftshift(przefiltrowane);
- i2 = ifft2(i1);
- figure;
- subplot(1,3,1);
- imshow(obraz);
- subplot(1,3,2);
- imshow(uint8(i2), []);
- subplot(1,3,3);
- imshow(imsubtract(obraz,uint8(i2)),[]);
- [f1, f2] = freqspace(512, 'meshgrid');
- Hd = ones(512);
- r = sqrt(f1.^2 + f2.^2);
- Hd((r<0.5)) = 0;
- h = fwind1(Hd, hanning(21));
- [H, f1, f2] = freqz2(h, 512, 512);
- przefiltrowane = przesuniecie.*H;
- i1 = ifftshift(przefiltrowane);
- i2 = ifft2(i1);
- figure;
- subplot(1,3,1);
- imshow(obraz);
- subplot(1,3,2);
- imshow(uint8(i2), []);
- subplot(1,3,3);
- imshow(imsubtract(obraz,uint8(i2)),[]);
- figure;
- mesh(f1,f2,H);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement