Upsampling 3D point cloud
8 views (last 30 days)
Show older comments
I have a point cloud and a mesh (connections between nodes) and I need to upsample the number of points and update the mesh including the new points .
My initial idea was to use triangulation to add the incenters to the original nodes and then create new triangulation and keep on increasing the number of nodes with incenters , but I dont know how to update the mesh .
I am sorry I can not provide the original data .As toy example I hope the following is enough
nodes = [0 0 0 ; 0 1 0 ; 1 0 0 ;1/2 1/2 1]
mesh = [1 2 3; 1 3 4 ; 2 3 4; 1 2 4]
With the previous example , the idea is to get for instance 100 nodes with out altering the shape , which means that the new points should be on the facets /triangles of the original data.
Thanks
0 Comments
Answers (1)
Shubham
on 22 Sep 2023
I understand that you want to upsample the number of points and update the mesh without altering its shape. You can expand on your idea of adding the incentre points of the triangles and further adding them in the mesh.
Using the toy example just to give the idea:
% Original data
nodes = [0 0 0; 0 1 0; 1 0 0; 1/2 1/2 1];
mesh = [1 2 3; 1 3 4; 2 3 4; 1 2 4];
% Plot the mesh
figure;
trisurf(mesh, nodes(:, 1), nodes(:, 2), nodes(:, 3), 'FaceColor', 'cyan');
axis equal;
xlabel('X');
ylabel('Y');
zlabel('Z');
% taking the left triangular face as it was visible (nodes 1,2,4)
% For automation use nodes(mesh(i,:),:) where i is loop variable
triangle = nodes(mesh(4, :), :)
edges = triangle([2 3 1], :) - triangle;
edge_lengths = vecnorm(edges, 2, 2)
perimeter = sum(edge_lengths);
weights = edge_lengths / perimeter;
incenters = sum(triangle .* weights, 1)
% Adding the 5th node (incenter point)
nodes=[nodes;incenters]
% Adding corresponding triangulations in the mesh
% Using old nodes: 1,2,4 and the new node 5(incenter node)
mesh = [mesh;1,2,5;
2,4,5;
4,1,5]
figure;
trisurf(mesh, nodes(:, 1), nodes(:, 2), nodes(:, 3), 'FaceColor', 'cyan');
axis equal;
xlabel('X');
ylabel('Y');
zlabel('Z');
The above code just gives the idea, how you can add further points. The code can be automated to add as many points as you desire.
The output of the code is as follows:
Original mesh:
Updated mesh:
Hope this helps!!
0 Comments
See Also
Categories
Find more on Point Cloud Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!