I want to draw black rectangles on an FFT magnitude image and apply the IFFT. I tried calculating the FFT I get 2 arrays one for the magnitude and the other for the phase after editing the magnitude image (I converted it to uint8) I don't know how to convert to the right input format for the IFFT. This the FFT code I'm using:
dft = np.fft.fft2(img)
dft_shift = np.fft.fftshift(dft)
mag = np.abs(dft_shift)
ang = np.angle(dft_shift)
That's the code I use to reconstruct the image:
def reconstruct(mag,ang):
combined = np.multiply(mag, np.exp(1j*ang))
fftx = np.fft.ifftshift(combined)
ffty = np.fft.ifft2(fftx)
imgCombined = np.abs(ffty)
return imgCombined
