Created
December 17, 2020 04:58
-
-
Save to-osaki/15218cd48fb4583a5941dd204eba7827 to your computer and use it in GitHub Desktop.
depth buffer to jpg
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 numpy as np | |
from PIL import Image | |
import matplotlib.pyplot as plt | |
with open("test.depth", "rb") as file: | |
bins = np.frombuffer(file.read(), dtype = np.uint16).reshape(cols, rows) | |
plt.imshow(bins) | |
Image.fromarray((bins / 24).astype(np.uint8)).save("./test.jpg") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment