Exclude some nodes from a 3D point cloud (select only neighboring nodes)

1 次查看(过去 30 天)
Hi! I would need code to create a matrix of nodes excluding those circled in red. Is there any code that I could use?
I would need a code where, for example, I select a node I am interested in and it automatically selects all neighboring nodes (within a certain distance x,y,z).
selection = importdata("selection.mat");
figure
plot3(selection(:,1),selection(:,2),selection(:,3),'b.','Markersize',5)
grid on
hold on
axis equal
xlabel('x')
ylabel('y')
zlabel('z')

采纳的回答

Matt J
Matt J 2023-5-13
编辑:Matt J 2023-5-13
X=load('selection').selection; %shorten data name
G=graph(pdist2(X,X)<=10);
T=conncomp(G);
[~,i]=max(histcounts(T,[unique(T),inf]));
I=T==i;
plot3(X(I,1),X(I,2),X(I,3),'b.','Markersize',5); hold on
plot3(X(~I,1),X(~I,2),X(~I,3),'r.','Markersize',5); hold off
grid on
axis equal
xlabel('x'),ylabel('y'),zlabel('z')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Point Cloud Processing 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by