看到this回答,这已经是高通过滤器了吗?
答案 0 :(得分:1)
您需要使用傅里叶变换并将低频归零。像这样:
I = imread('cameraman.tif');
%fourier transform
If = fftshift(fft2(I));
%create the filter as a mask with circle of radius 50
rx = (1:size(I,1)) - size(I,1)/2;
ry = (1:size(I,2)) - size(I,2)/2;
[X,Y] = meshgrid(rx,ry);
R = sqrt(X.^2 + Y.^2);
Ifhw = If;
Ifhw(R < 25) = 0; % we kill the low frequencies
%get the inversed fourier transform
Ihw = abs(ifft2(Iflw));
%use the abs log for visualization purposes
abslog = @(X)(log(abs(X)+1));
figure
subplot(2,2,3)
imshow(abslog(If), [])
title('fft in the original image')
subplot(2,2,4)
imshow(abslog(Iflw), [])
title('fft low pass filter image')
subplot(2,2,1)
imshow(I, [])
title('original image')
subplot(2,2,2)
imshow(Ilw, [])
title('low pass filter image')