I perform 2D FFT on a particular image and I get its spectral components. Now this image is superimposed with another image to create periodic noise.
The original image as well as the periodic noise version are shown below:
Source image

Periodic noise image

To filter this out, I used manual boxes that masked the components in the amplitude spectrum, which are quite large compared to other components, as shown below.

After that, I perform the inverse FFT, but I do not get the original image back.

Does anyone know what I'm doing wrong?
Here is the code that masks the values ββand then performs the inverse 2D FFT on the masked spectral image:
pat1 = imread('Pattern1.png'); spec_orig = fft2(double(pat1)); spec_orig2 = abs(spec_orig); spec_img = fftshift(spec_orig2); for j = 115:125 for n = 96:106 spec_img(n,j) = 0; end for n = 216:226 spec_img(n,j) = 0; end for n = 274:284 spec_img(n,j) = 0; end for n = 298:308 spec_img(n,j) = 0; end for n = 12:22 spec_img(n,j) = 0; end for n = 37:47 spec_img(n,j) = 0; end end %Getting Back the Image for Pattern1 figure;subplot(2,1,1); spec_img = log(1 + spec_img); imshow(spec_img,[]); subplot(2,1,2); ptnfx = ifft2(spec_img); imshow(ptnfx);
source share