在图像处理领域,巴特沃斯低通滤波器(BLPF)用于频域中的图像平滑。它可以消除数字图像中的高频噪声,并保留低频分量。订单BLPF的传递函数被定义为-
在哪里,
- 是一个正常数。 BLPF通过的所有频率小于值不衰减,并切断所有大于该值的频率。
- 这是H(u,v)= 1和H(u,v)= 0之间的过渡点,因此称为截止频率。但是,它没有进行陡峭的截止(例如理想低通滤波器(ILPF)),而是引入了从1到0的平滑过渡以减少振铃失真。
- 是从任意点(u,v)到频率平面原点的欧几里得距离,即
Approach:
Step 1: Input – Read an image
Step 2: Saving the size of the input image in pixels
Step 3: Get the Fourier Transform of the input_image
Step 4: Assign the order and cut-off frequency
Step 5: Designing filter: Butterworth Low Pass Filter
Step 6: Convolution between the Fourier Transformed input image and the filtering mask
Step 7: Take Inverse Fourier Transform of the convoluted image
Step 8: Display the resultant image as output
在MATLAB中的实现:
% MATLAB Code | Butterworth Low Pass Filter
% Reading input image : input_image
input_image = imread('[name of input image file].[file format]');
% Saving the size of the input_image in pixels-
% M : no of rows (height of the image)
% N : no of columns (width of the image)
[M, N] = size(input_image);
% Getting Fourier Transform of the input_image
% using MATLAB library function fft2 (2D fast fourier transform)
FT_img = fft2(double(input_image));
% Assign the order value
n = 2; % one can change this value accordingly
% Assign Cut-off Frequency
D0 = 20; % one can change this value accordingly
% Designing filter
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;
% MATLAB library function meshgrid(v, u) returns
% 2D grid which contains the coordinates of vectors
% v and u. Matrix V with each row is a copy of v
% and matrix U with each column is a copy of u
[V, U] = meshgrid(v, u);
% Calculating Euclidean Distance
D = sqrt(U.^2 + V.^2);
% determining the filtering mask
H = 1./(1 + (D./D0).^(2*n));
% Convolution between the Fourier Transformed
% image and the mask
G = H.*FT_img;
% Getting the resultant image by Inverse Fourier Transform
% of the convoluted image using MATLAB library function
% ifft2 (2D inverse fast fourier transform)
output_image = real(ifft2(double(G)));
% Displaying Input Image and Output Image
subplot(2, 1, 1), imshow(input_image),
subplot(2, 1, 2), imshow(output_image, [ ]);
输入图像–
输出:
注意: 1阶巴特沃斯滤波器没有振铃伪影。通常,在2阶滤波器中不会感觉到振铃,但是在高阶滤波器中,振铃可能会成为重要因素。对于特定的截止频率,振铃随着滤波器阶数的增加而增加。