diff --git a/datasets/raise/fft/image_to_fourier.py b/datasets/raise/fft/image_to_fourier.py index c2c6808..c7baedc 100644 --- a/datasets/raise/fft/image_to_fourier.py +++ b/datasets/raise/fft/image_to_fourier.py @@ -3,19 +3,13 @@ import numpy as np from scipy import fftpack import matplotlib.pyplot as plt -image = np.array(Image.open('image_4.png').convert('L'))# / 255 -print(image) +image = np.array(Image.open('circle.png').convert('L'))# / 255 # fft of image -# fftpack.fftshift -fft1 = (fftpack.fft2(image)) - -height, width = fft1.shape -for x in range(width): - fft1[height // 2, x] = np.median(fft1[:, x]) +fft1 = fftpack.fftshift(fftpack.fft2(image)) # save the image -# np.log10 -plt.imshow(np.log10(abs(fft1))) +toDisplay = np.log10(abs(fft1)) +plt.imshow(toDisplay) plt.show() -#plt.imsave('ifft1.png', np.log10(abs(fft1))) \ No newline at end of file +plt.imsave('ifft1.png', toDisplay) \ No newline at end of file