MATLAB Answers

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

11 views (last 30 days)
Lim Kai Wei
Lim Kai Wei on 1 Nov 2019
Answered: Subhadeep Koley on 4 Nov 2019
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));

  0 Comments

Sign in to comment.

Answers (1)

Subhadeep Koley
Subhadeep Koley on 4 Nov 2019
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

  0 Comments

Sign in to comment.

Sign in to answer this question.