How to recover image from IFFT after removing high frequency descriptors?

15 ビュー (過去 30 日間)
Lim Kai Wei
Lim Kai Wei 2019 年 11 月 1 日
回答済み: Subhadeep Koley 2019 年 11 月 4 日
I am trying to perform FFT on the boundary coordinates of a binary image, trimming off x% of the fourier descriptors and then performing IFFT to recover the image. However my image is very much distorted and does not resemble the original image at all (I was told that it is possible to recreate the image quite accurately even after trimming). I have included my code below, much help would be appreciated.
boundary_complex = boundary(:,1) + i*boundary(:,2);
boundary_freq = fft(boundary_complex);
usedPercent=0.9;
n = round(usedPercent*length(boundary_freq));
trim_boundary_freq = boundary_freq(1:n);
IFF = ifft(trim_boundary_freq);
figure,plot(real(IFF),imag(IFF));

回答 (1 件)

Subhadeep Koley
Subhadeep Koley 2019 年 11 月 4 日
Hi, it is difficult to provide an exact solution without your image but below is an example of removing high frequency descriptors from a binary image.
% Read the image
I = imread('cameraman.tif');
% Binarization
I = imbinarize(I,0.5);
% Fourier transfrom
f = fftshift(fft2(I));
% Absolute values of the fourier magnitude
fabs=abs(f);
% Log transfrom for display
fLog = log(1 + abs(f));
% Trimming off some fourier descriptors
filter = (fLog > .5*max(fLog(:)) );
% Applying filter
B = abs(ifft2(f.*filter));
% Plotting
figure;
subplot(2,2,1),imshow(I,[]); title('Original Image');
subplot(2,2,2),imshow(fLog,[]); title('Fourier Magnitude Plot');
subplot(2,2,3),imshow(filter,[]); title('Filter Mask');
subplot(2,2,4),imshow(imbinarize(B,0.5),[]); title('Filtered Image');
fourier.png

Community Treasure Hunt

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

Start Hunting!

Translated by