Skip to content

Instantly share code, notes, and snippets.

@to-osaki
Created December 17, 2020 04:58
Show Gist options
  • Save to-osaki/15218cd48fb4583a5941dd204eba7827 to your computer and use it in GitHub Desktop.
Save to-osaki/15218cd48fb4583a5941dd204eba7827 to your computer and use it in GitHub Desktop.
depth buffer to jpg
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