15 lines
362 B
Python
15 lines
362 B
Python
from PIL import Image
|
|
import numpy as np
|
|
from scipy import fftpack
|
|
import matplotlib.pyplot as plt
|
|
|
|
fft = np.array(Image.open('fft.png').convert('L'))# / 255
|
|
print(fft)
|
|
|
|
ifft2 = np.real(fftpack.ifft2(fftpack.ifftshift(fft)))
|
|
ifft2 = np.maximum(0, np.minimum(ifft2, 255)) * 255# / 255
|
|
|
|
# save the image
|
|
plt.imshow(ifft2)
|
|
plt.show()
|
|
#plt.imsave('ifft2.png', ifft2) |