From da5b19f047b1f4f34c65a857e0062d1ab7efe667 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Thu, 16 May 2024 01:39:06 +0200 Subject: [PATCH] Clean `image_to_fourier.py` --- datasets/raise/fft/image_to_fourier.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) 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