Skip to content

Instantly share code, notes, and snippets.

@prl900
Created March 19, 2020 00:54
Show Gist options
  • Save prl900/915fdbcaf977b882e3ac0a82fc7276bd to your computer and use it in GitHub Desktop.
Save prl900/915fdbcaf977b882e3ac0a82fc7276bd to your computer and use it in GitHub Desktop.
from pylab import *
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.cbook import get_sample_data
from matplotlib._png import read_png
import imageio
from PIL import Image
img1 = imageio.imread("image1.jpg")
img1 = img1/255
img2 = imageio.imread("image2.jpg")[:394,:394,:]
im = Image.fromarray(img2)
im = im.resize((512,512))
img2 = np.asarray(im)
img2 = img2/255
img3 = imageio.imread("image3.png")[:512,300:812,:3]
img3 = img3/255
x, y = ogrid[:img1.shape[0], :img1.shape[1]]
ax = gca(projection='3d')
ax.plot_surface(x, y, np.ones(img1.shape[:2])*4, rstride=1, cstride=1, facecolors=img1, shade=False)
ax.plot_surface(x, y, np.ones(img1.shape[:2])*2, rstride=1, cstride=1, facecolors=img2, shade=False)
ax.plot_surface(x, y, np.ones(img1.shape[:2])*0, rstride=1, cstride=1, facecolors=img3, shade=False)
show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment