Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

# Subsample point cloud based on the density of another point cloud

See original GitHub issue

Hi @marcomusy,

I am trying to subsample a point cloud based on the density of another point cloud. For example I have the following two point clouds of different sizes, i.e. with green and red color:

Now I want to do two operations to subsample a point cloud based on 1. a given fixed number of points or 2. based on how the density or the specified fraction of the object size of another point cloud is. The idea is to subsample the smaller point cloud to a given number of points and then the bigger point cloud to a number of points based on the density of the smaller point cloud after the subsampling. So that they have similar density and not one point cloud to be dense and the other sparse and to keep let’s say a similar kind of fraction distance between the points of the two point clouds. For example the output in the image bellow:

``````vd.show(pcds[0].clone().subsample(0.05), pcds[1].clone().subsample(0.05), axes=1, interactive=True).close()
``````

is not ideal since the smaller part is more dense than the larger part.

I was checking on the `subsample()` and `density()` operations. The `subsample()` method needs a fraction number so you cannot pass a fixed number of points and the `density()` function I am not sure whether it is relevant to be used for extracting such a number.

### Issue Analytics

• State:
• Created a year ago

1reaction
marcomusycommented, Oct 6, 2022

well it very much depends if you consider “closed” clouds (clouds which may define a surface) or “dense” clouds where points are scattered in the full 3d space… the the concept of “volume” means different things. I don’t see any objective way to define it, or translate it to the subsample() method, you need to do it based on the problem at hand.

1reaction
ttsesmcommented, Oct 5, 2022

Yes the `absolute=True` parameter is fixed now.

I agree regarding measuring density/sparsity that it is a bit ambiguous how to measure it. I am also trying to figure out the best way.

#### Top Results From Across the Web

Tutorial: Subsampling in CloudCompare | 3D Forensics
Do you want to learn how to edit point clouds, combine, filter, transform, register and even animate 3D data? Be informed as soon...
Uniform subsampling of point cloud manifold - GitLab
We create a dataset with 10 Mio. samples of 2-dim. points for visualization ... A uniform sampling density is a useful property for...
Edit\Subsample - CloudCompareWiki
Subsamples a point cloud (i.e. decreases the number of points). Several subsampling methods are available: random; spatial; octree-based.
An Iterative Coarse-to-Fine Sub-Sampling Method for ... - MDPI
The method proposed is tested using four point clouds representing terrain surfaces with distinct spatial characteristics.
Density-Adaptive Sampling for Heterogeneous Point Cloud ...
deep learning architectures for point cloud data from other domains less effective. ... from 82.73% using voxel-based sampling to 92.25% us-.

#### Troubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free