Last active
February 23, 2018 06:58
-
-
Save dyf/cf474692487fec70a9c277d2fb04af9c to your computer and use it in GitHub Desktop.
flat jupiter
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 matplotlib.pyplot as plt | |
import imageio | |
import numpy as np | |
from scipy.signal import medfilt | |
# from here | |
# https://www.nasa.gov/multimedia/imagegallery/image_feature_539.html | |
im = imageio.imread('jupiter_bottom.jpg') | |
off = [16,-1] | |
rtrim = 200 | |
angles = 2000 | |
rmax = int(im.shape[1]*0.5-rtrim) | |
r = np.arange(0,rmax) | |
th = np.linspace(0, 2*np.pi, angles) | |
r, th = np.meshgrid(r,th,indexing='ij') | |
x,y = r * np.cos(th), r * np.sin(th) | |
x = np.round(x+im.shape[1]*0.5+off[1]).astype(int) | |
y = np.round(y+im.shape[0]*0.5+off[0]).astype(int) | |
flatim = im[y,x] | |
fig, (ax1, ax2) = plt.subplots(1,2, figsize=(10,10), gridspec_kw={'width_ratios': (1,2)}) | |
ax1.imshow(im) | |
ax1.axis('off') | |
ax2.imshow(flatim, origin='lower') | |
ax2.axis('off') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment