Clean image_to_fourier.py
This commit is contained in:
parent
eb33def18c
commit
da5b19f047
@ -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)))
|
||||
plt.imsave('ifft1.png', toDisplay)
|
Loading…
x
Reference in New Issue
Block a user