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

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.

댓글을 달려면 로그인하십시오.

 채택된 답변

darova
darova 2019년 8월 1일
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

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

릴리스

R2019a

질문:

2019년 8월 1일

댓글:

2019년 8월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by