Matlab's frequency domain filtering under the three major LPF


一, initial knowledge

  1. However, it does not matter if you don't understand the meaning of the function, just remember, fftshift(distmatrix) generated Is the distance from each coordinate to the center coordinate can be
[M,N] = size(tif);
D = distmatrix(M,N);
Dist = fftshift(D); % distance matrix (from center)


  1. About the Fourier transform, knowing the frequency domain filtering knows that the Fourier transform is Time domain (space domain) to frequency domain transition, for 2D Fourier transform, coordinates (1,1) % (0,0)% in Python is a DC signal with a frequency of 0, coordinates (u, v) are in The signal with the frequency in the x direction is u, and the frequency in the y direction is v

二, the ideal LPF

, due to the excessive bluntness, the image will produce ringing artifacts.

% idea LPF
H1 = zeros(M,N);
radius = 35;
ind = dist <= radius;
H1(ind) = 1;
Hd1 = double(H1);

三,Gauss LPF

% Gaussion LPF
sigma = 30;
H2 = exp(-dist.^2/2/sigma^2);
Hd2 = double(H2);

四, Butterworth (LPT

% Butterworth LPF
D0 = 30;
n = 3;
H3 = 1./(1+(dist/D0).^(2*n));
Hd3 = double(H3);