kaolin.ops.pointcloud

API

kaolin.ops.pointcloud.center_points(points: FloatTensor, normalize: bool = False, eps=1e-06)

Returns points centered at the origin for every pointcloud. If normalize is set, will also normalize each point cloud spearately to the range of [-0.5, 0.5]. Note that each point cloud is centered individually.

Parameters
  • points (torch.FloatTensor) – point clouds of shape \((\text{batch_size}, \text{num_points}, 3)\), (other channel numbers supported).

  • normalize (bool) – if true, will also normalize each point cloud to be in the range [-0.5, 0.5]

  • eps (float) – eps to use to avoid division by zero when normalizing

Returns

(torch.FloatTensor) modified points with same shape, device and dtype as input

kaolin.ops.pointcloud.farthest_point_sampling(points, k)

Performs farthest point sampling to select a subset of \(k\) points from a point cloud. The first point returned is the one most distant from the center, and each subsequent point is the one most distant from the previously-selected set.

This operation is useful for generating a nicely-spaced subset of a large point cloud, with a blue-noise-like distribution.

Even if the point cloud countains inf or NaN coordinates, this function will always return exactly \(k\) distinct indices.

Parameters
  • points (torch.FloatTensor) – point clouds of shape \((\text{batch_size}, \text{num_points}, 3)\)

  • k (int) – the number of farthest points to sample. Must be \(0 <= k <= \text{num_points}\)

Returns

(torch.LongTensor) indices into the points tensor giving each sampled point, shape \((\text{batch_size}, \text{k})\)