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

4 vues (au cours des 30 derniers jours)
Alberto Acri
Alberto Acri le 11 Mai 2023
Modifié(e) : Matt J le 13 Mai 2023
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')

Réponse acceptée

Matt J
Matt J le 13 Mai 2023
Modifié(e) : Matt J le 13 Mai 2023
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')

Plus de réponses (0)

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by