Created
July 29, 2020 18:23
-
-
Save nenoNaninu/892857827e01548859f2cff3cb1b0dcd to your computer and use it in GitHub Desktop.
visualize occupancy
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 | |
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