Filter High Pass Using Fourier Transform

9 views (last 30 days)
Akbar Ramadhan
Akbar Ramadhan on 27 Feb 2021
Edited: Akbar Ramadhan on 1 Mar 2021
Hi, I tried fourier’s transform with a few high pass filters, but the code I made was not showing the process. So, someone could help me check the code.
FFT_ihpf=getimage(handles.axes5);
[M, N]= size(FFT_ihpf);
ft_ihpf=fft2(double(FFT_ihpf));
ihpf=fftshift(ft_ihpf);
figure(1);
imshow(abs(ft_ihpf),[]);
figure(2);
imshow(abs(ihpf),[]);
ihpf_logshift=log(1+abs(ihpf));
% axes (handles.axes10);
figure(3); imshow(abs(ihpf_logshift),[]);
n=2;
D0=20;
% D0= str2double(get(handles.edit5, 'String'));
% D0 =D0/100;
% % u=0:(M-1);
% % v=0:(N-1);
% % idX = find (u > M/2);
% % u(idX) = u(idX) - M;
% % idY = find (v > N/2);
% % v(idY) = v(idY) - N;
u = M/2;
v = N/2;
for i=1:M;
for j=1:N;
[V, U] = meshgrid(v, u);
D = sqrt((i-u).^2+(v-j).^2);
% H = double(D > D0);%IHPF
H = 1./(1 + (D0./D).^(2*n)); %BHPF
% H = 1-exp(-(D)^2/(2*(D0^2)));%GHPF
end
end
filter_G = H .* ihpf_logshift;
% axes(handles.axes11)
figure(4);
imshow(abs(filter_G),[]);
Out_ifft=ifftshift(filter_G);
% axes(handles.axes12)
figure(5);
imshow(abs(Out_ifft),[]);
ori= ifft2(Out_ifft);
figure(6);
imshow(log(abs(ori)));
but the result of IFFT2 showing no image and only black figure. please help me.

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!