<>Butterworth LPF

<>公式

H ( u , v ) = 1 1 + ( D ( u , v ) D 0 ) 2 n H(u, v) = \frac{1}{1 +
(\frac{D(u, v)}{D_0})^{2n}}H(u,v)=1+(D0​D(u,v)​)2n1​

D(u, v)定义如下:
D ( u , v ) = [ ( u − M 2 ) 2 + ( v − N 2 ) 2 ] 1 2 D(u, v) = [(u -
\frac{M}{2})^2 + (v - \frac{N}{2})^2]^{\frac{1}{2}}D(u,v)=[(u−2M​)2+(v−2N​)2]21​

(\frac{M}{2}, \frac{N}{2})(2M​,2N​)，中心变换操作可以通过和 ( − 1 ) x + y (-1)^{x + y} (−1)x
+y做相关得到，可以通过傅里叶变换的平移性得到)

<>matlab步骤

（1）以 ( − 1 ) ( x + y ) (-1)^{(x + y)} (−1)(x+y) 乘以输入图像进行中心变换；
% uint8 f = imread('your_image_file'); % double f = im2double(f); [X, Y] =
meshgrid(1:width, 1:height); cent = f.*(-1).^(X + Y);
（2）直接以FFT2进行傅立叶变换；
F = fft2(cent);
（3）进行Butterworth滤波
% generate Butterworth filtering kernel kernel = zeros(height, width); for u =
1:height for v = 1:width D = sqrt((u - height / 2)^2 + (v - width / 2)^2);
kernel(u, v) = 1 / (1 + (D / D0)^2); end end % fitering F = F.*kernel;
（4）DFT反变换后取实部；
% get conjugate F for u = 1:height for v = 1:width F(u, v) = (real(F(u, v)) -
imag(F(u, v)) * 1i) / (height * width); end end % get conjugate f by doing
2-dimension FFT on conjugate F cent = fft2(F); % get real part for u = 1:height
for v = 1:width cent(u, v) = real(cent(u, v)); end end
（5）以 ( − 1 ) ( x + y ) (-1)^{(x + y)} (−1)(x+y) 乘以（3）中结果，反中心变换。
f = cent.* (-1).^(X + Y);
<>滤波效果

f ( x , y ) ∗ g ( x , y ) ⟷ F ( x , y ) ⋅ G ( x , y ) f(x, y) * g(x, y)
\longleftrightarrow F(x, y) \cdot G(x, y)f(x,y)∗g(x,y)⟷F(x,y)⋅G(x,y)

GitHub

Gitee