open3d.ml.torch.ops.voxelize¶
-
open3d.ml.torch.ops.
voxelize
(points, voxel_size, points_range_min, points_range_max, max_points_per_voxel=9223372036854775807, max_voxels=9223372036854775807)¶ Voxelization for point clouds.
The function returns the integer coordinates of the voxels that contain points and a compact list of the indices that associate the voxels to the points.
Minimal example:
import open3d.ml.tf as ml3d points = [ [0.1,0.1,0.1], [0.5,0.5,0.5], [1.7,1.7,1.7], [1.8,1.8,1.8], [9.3,9.4,9.4]] ml3d.ops.voxelize(points, voxel_size=[1.0,1.0,1.0], points_range_min=[0,0,0], points_range_max=[2,2,2]) # returns the voxel coordinates [[0, 0, 0], # [1, 1, 1]] # # the point indices [0, 1, 2, 3] # # and the point row splits [0, 2, 4] # or with pytorch import torch import open3d.ml.torch as ml3d points = torch.Tensor([ [0.1,0.1,0.1], [0.5,0.5,0.5], [1.7,1.7,1.7], [1.8,1.8,1.8], [9.3,9.4,9.4]]) ml3d.ops.voxelize(points, voxel_size=torch.Tensor([1.0,1.0,1.0]), points_range_min=torch.Tensor([0,0,0]), points_range_max=torch.Tensor([2,2,2])) # returns the voxel coordinates [[0, 0, 0], # [1, 1, 1]] # # the point indices [0, 1, 2, 3] # # and the point row splits [0, 2, 4]
- points: The point positions with shape [N,D] with N as the number of points and
D as the number of dimensions, which must be 0 < D < 9.
voxel_size: The voxel size with shape [D].
- points_range_min: The minimum range for valid points to be voxelized. This
vector has shape [D] and is used as the origin for computing the voxel_indices.
- points_range_min: The maximum range for valid points to be voxelized. This
vector has shape [D].
max_points_per_voxel: The maximum number of points to consider for a voxel.
max_voxels: The maximum number of voxels to generate.
- voxel_coords: The integer voxel coordinates.The shape of this tensor is [M, D]
with M as the number of voxels and D as the number of dimensions.
- voxel_point_indices: A flat list of all the points that have been voxelized.
The start and end of each voxel is defined in voxel_point_row_splits.
- voxel_point_row_splits: This is an exclusive prefix sum that includes the total
number of points in the last element. This can be used to find the start and end of the point indices for each voxel. The shape of this tensor is [M+1].