How to slice a point cloud along z axis
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
stefano chiappini
am 7 Mär. 2022
Bearbeitet: Chen Xinzhuo
am 8 Feb. 2023
Hi, i got the following question:
i have a crown tree point cloud and i need to slice along z axis with with 10 cm thickness. Finally, i need to calculate the volume by alpha shape algorithm for each individual slice.
How to solve these problem?
Thank you so much![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/917844/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/917844/image.jpeg)
0 Kommentare
Akzeptierte Antwort
Paola Donis Noriega
am 28 Apr. 2022
You can slice a point cloud along the z-axis as follows:
% Use the teapot point cloud as an example.
ptCloud = pcread('teapot.ply');
% Get the point cloud z limits.
minZ = ptCloud.ZLimits(1);
maxZ = ptCloud.ZLimits(2);
% Define the thickness of each slice.
thickness = 0.1;
% Use pcplayer to visualize the point cloud slices.
player = pcplayer(ptCloud.XLimits, ptCloud.YLimits, ptCloud.ZLimits);
% Use a for loop to select each point cloud slice.
for i = minZ:thickness:maxZ
% Get the logical indices of the points in each slice.
selectedIdx = ptCloud.Location(:, 3) >= i & ...
ptCloud.Location(:, 3) < (i + thickness);
% Select the point cloud slice using the indices.
ptCloudSlice = select(ptCloud, selectedIdx);
% Visualize the slice.
view(player, ptCloudSlice)
pause(0.2)
end
5 Kommentare
Chen Xinzhuo
am 8 Feb. 2023
Bearbeitet: Chen Xinzhuo
am 8 Feb. 2023
Hi Stefano,
I also encountered the same problem recently.
I have tried but still don't know how to extract each point cloud slice.
I want to ask what method you use, please.
Thank you.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Point Cloud Processing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!