Created
July 26, 2020 02:45
-
-
Save mfornet/16ae00ea63d9e3aecf3b5facd398df9b to your computer and use it in GitHub Desktop.
Discover the animal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %%% | |
import PIL.Image | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# %% | |
im = PIL.Image.open("panda.jpeg") | |
arr = np.array(im).mean(2) | |
freq = np.fft.fft2(arr) | |
n, m = freq.shape | |
for i in range(n): | |
for j in range(m): | |
if min(i, j) >= 10: | |
freq[i, j] = 0 | |
inv_arr = np.fft.ifft2(freq) | |
for i in range(n): | |
for j in range(m): | |
inv_arr[i, j] = abs(inv_arr[i, j]).real | |
inv_array = inv_arr.astype(float) | |
plt.imshow(inv_array, cmap='gray') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment