Subsample a point cloud at specified points/regions

Feel free to ask any question here
Post Reply
galex
Posts: 6
Joined: Wed Jul 12, 2023 8:15 pm

Subsample a point cloud at specified points/regions

Post by galex »

Hello,

I have two point clouds. One point cloud is well populated and dense, each point's magnitude represents strain. The other point cloud is much less populated and dense, each point's magnitude represents the average 3 nearest neighbor value (also spatially it is the center of an embryonic heart cell). My goal is to sample the small points in the dense cloud that are in the vicinity of the large points in the sparse cloud.

Is this possible with CloudCompare? I have attached a screen shot showing what my clouds look like.

Thanks!

Image
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Subsample a point cloud at specified points/regions

Post by daniel »

Yep, you can simply compute the Cloud-to-cloud distances between the dense cloud (as the 'compared' cloud) and use the low density cloud as 'reference'. Then you can keep only the points with a small distance.

There's even a tool named 'Tools > Distances > Closest Point Set' that will return directly the closest points of one cloud (= the dense one) with respect to another one.
Daniel, CloudCompare admin
galex
Posts: 6
Joined: Wed Jul 12, 2023 8:15 pm

Re: Subsample a point cloud at specified points/regions

Post by galex »

Thank you, Daniel. I see this is quite simple to do. However, I ultimately would like to plot each of the sparse point's attached data (avg 3 nearest neighbor distance) against that points corresponding strain data in the other cloud (which I will average). Would it be possible to index the points in the sparse cloud and attach each unique sparse point to it's corresponding points in the dense cloud?

Image
galex
Posts: 6
Joined: Wed Jul 12, 2023 8:15 pm

Re: Subsample a point cloud at specified points/regions

Post by galex »

So my extracted data would look something like this:

X1 (sparse cloud), Y1 (sparse cloud), Z1 (sparse cloud), Scalar at point 1 (sparse cloud), X1 (dense cloud), Y1 (dense cloud), Z1 (dense cloud), Scalar at point 1 (dense cloud)
X1 (sparse cloud), Y1 (sparse cloud), Z1 (sparse cloud), Scalar at point 1 (sparse cloud), X2 (dense cloud), Y2 (dense cloud), Z2 (dense cloud), Scalar at point 2 (dense cloud)
...
X1 (sparse cloud), Y1 (sparse cloud), Z1 (sparse cloud), Scalar at point 1 (sparse cloud), XN (dense cloud), YN (dense cloud), ZN (dense cloud), Scalar at point N (dense cloud)
Where N = point index/identification out of total number of points in dense cloud

then onto the next sparse cloud point with its own set of dense cloud points:
X2 (sparse cloud), Y2 (sparse cloud), Z2 (sparse cloud), Scalar at point 2 (sparse cloud), X1 (dense cloud), Y1 (dense cloud), Z1 (dense cloud), Scalar at point 1 (dense cloud)
X2 (sparse cloud), Y2 (sparse cloud), Z2 (sparse cloud), Scalar at point 2 (sparse cloud), X2 (dense cloud), Y2 (dense cloud), Z2 (dense cloud), Scalar at point 2 (dense cloud)
galex
Posts: 6
Joined: Wed Jul 12, 2023 8:15 pm

Re: Subsample a point cloud at specified points/regions

Post by galex »

Hey everybody, I think I figured out how to do this.

I interpolated my dense point cloud onto my sparse point cloud. I used the Radius (sphere) option with average interpolation. This gave me a SF in the sparse point cloud where the scalars were averages of all the dense points that fell within 10 microns of my sparse points... at least I think that's what I did. Now I'm trying to generate an idealized dataset to confirm my results.

Also, it really helped to reduce my confusion after I realized I could rename my scalar fields. I'm new to CloudCompare!
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Subsample a point cloud at specified points/regions

Post by daniel »

Great! Good job.
Daniel, CloudCompare admin
galex
Posts: 6
Joined: Wed Jul 12, 2023 8:15 pm

Re: Subsample a point cloud at specified points/regions

Post by galex »

Hi Daniel, one more thing.

Would it be possible to add in standard deviation and n or count to "interpolate from another entity" under interpolation algorithm? Currently the options are Average, Median, and Normal distribution. It would just be nice to have more stats so I can make error bars. Or is there another way to do this?
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Subsample a point cloud at specified points/regions

Post by daniel »

The 'sigma' parameter is already the standard deviation (for the 'Normal distribution' mode). It is not clear to me what you need in addition to that?
Daniel, CloudCompare admin
galex
Posts: 6
Joined: Wed Jul 12, 2023 8:15 pm

Re: Subsample a point cloud at specified points/regions

Post by galex »

Thanks Daniel, but I guess don't quite understand what the sigma parameter is. It seems like the output is still just an average, but weighted, as per "Compute a weighted average of the neighbors SF values" when I hover on the "Normal distribution" option.

I need to calculate the average of the points' SF that fall within my set radius. Then, from the mean and n, I would like to calculate the standard deviation.

The best thing for me would be to just get all the points and their scalar values that fall within the sphere (radius) I specify, then I could calculate the average and standard deviation myself.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Subsample a point cloud at specified points/regions

Post by daniel »

Ah yes, then the easier would be to hack the code (you could add new 'features' to the Tools > Other > Compute Geometric features' tool). Or use the CloudCompy wrapper?
Daniel, CloudCompare admin
Post Reply