How to test if points are inside a point cloud model

I have a point cloud of a tree trunk, imported as a ply file. It is a point cloud so the tree trunk is not a surface, but points with gaps in between.
I also have the 3D coordinates of a bunch of points. How do I remove those points that are not inside the tree trunk? The model is not parallel with the axes by the way.
Here's a dropbox link for the ply file. Coordinates and values of the points are in the attached all_control_points.mat file. There's no code yet except the ones to generate this data.
https://www.dropbox.com/s/vf5id1hv0anruzx/Trunk%20Only.ply?dl=0

2 Kommentare

Can you post your code and data please?
Sorry for not including this. I have updated the question with the data. The ply file of the point cloud is too big so I'm sharing a dropbox link for it. There's no code yet except the ones used to generate the data.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

darova
darova am 1 Aug. 2019
Hi. I wrote a script and somehow it works 0_0. See attached script
This is what i ahieved
img0.png img1.png img2.png
Maybe someone can please explain why (and how) it works
% xc,yc,zc - control points (red on the image)
% xt,yt,zt - tree point (blue on the image)
ri = sqrt(xt(it).^2 + yt(it).^2); % radius of tree points
ri1 = griddata(xt(it), yt(it), zt(it), ri, ...
xc,yc,zc);
griddata() generates radius for points inside only (NaN for other)

2 Kommentare

Thank you so much, it works! I don't know why the griddata works either though.
Also, how did you determine that the model should be rotated by 75 degrees?
It's approximately. Just wanted the tree axis to be parallel to Z

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Version

R2019a

Gefragt:

am 1 Aug. 2019

Kommentiert:

am 2 Aug. 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by