-
Notifications
You must be signed in to change notification settings - Fork 2.4k
How to convert the `open3d.geometry.VoxelGrid` into a `NumPy` array
AlexZakIntel edited this page Jan 27, 2022
·
3 revisions
You can get the voxel indices and colors as Numpy
arrays like this:
voxels = voxel_grid.get_voxels() # returns list of voxels
indices = np.stack(list(vx.grid_index for vx in voxels))
colors = np.stack(list(vx.color for vx in voxels))
To get the color of a point given its coordinates, use this function:
The returned voxel has grid_index and color fields. If you directly have the voxel index, you will need to convert it to the coordinates of the center of the voxel first.
For more detailed information, please see our Issues page at: https://github.com/isl-org/Open3D/issues/1418#issuecomment-1003460629