pypose.random_filter¶
- class pypose.random_filter(points, num)[source]¶
Randomly sample a number of points from a batched point cloud.
- Parameters:
points (
torch.Tensor
) – the input point cloud, where the last dimension (D) is the dimension of the points. The shape should be (…, N, D), where N is the number of points.num (
int
) – the number of points to sample.
- Returns:
The sampled points, with the shape (…, num, D).
- Return type:
output (
torch.Tensor
)
Example
>>> import torch, pypose as pp >>> points = torch.tensor([[1., 2., 3.], ... [4., 5., 6.], ... [7., 8., 9.], ... [10., 11., 12.], ... [13., 14., 15.]]) >>> pp.random_filter(points, 3) tensor([[ 4., 5., 6.], [ 1., 2., 3.], [10., 11., 12.]])