Skip to content

Instantly share code, notes, and snippets.

@nenoNaninu
Created July 29, 2020 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nenoNaninu/892857827e01548859f2cff3cb1b0dcd to your computer and use it in GitHub Desktop.
Save nenoNaninu/892857827e01548859f2cff3cb1b0dcd to your computer and use it in GitHub Desktop.
visualize occupancy
import numpy as np
import open3d as o3d
points_dict = np.load("points.npz")
points = points_dict['points']
if points.dtype == np.float16:
points = points.astype(np.float32)
points += 1e-4 * np.random.randn(*points.shape)
else:
points = points.astype(np.float32)
occupancies = points_dict['occupancies']
if True:
occupancies = np.unpackbits(occupancies)[:points.shape[0]]
occupancies = occupancies.astype(np.float32)
index = np.where(occupancies > 0.5)
points = points[index]
print(points)
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(points)
o3d.visualization.draw_geometries([pcd])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment