15 lines
345 B
Python
15 lines
345 B
Python
from PIL import Image
|
|
import numpy as np
|
|
from scipy import fftpack
|
|
import matplotlib.pyplot as plt
|
|
|
|
image = np.array(Image.open('circle.png').convert('L'))# / 255
|
|
|
|
# fft of image
|
|
fft1 = fftpack.fftshift(fftpack.fft2(image))
|
|
|
|
# save the image
|
|
toDisplay = np.log10(1 + abs(fft1))
|
|
plt.imshow(toDisplay)
|
|
plt.show()
|
|
plt.imsave('ifft1.png', toDisplay) |