I have a point cloud in .ply format. I want to segment and export a certain number of slices along Z axis.
How can i gain this output?
thank you so much.

 채택된 답변

Adam Danz
Adam Danz 2021년 5월 24일

1 개 추천

> I want to segment and export a certain number of slices along Z axis
The following two demos use the attached file teatpotOut.ply which is within a zip file since we cannot attach ply files. The two demos show two different interpretations of the question.
Interpretation 1: segmenting specific z-values
Read-in the ply file
teapotOut.ply = unzip('teapotOut.zip');
ptCloud = pcread('teapotOut.ply');
List z-values of interest
This demo selects every 500-th unique z-value resulting in 11 z-values.
zUnq = unique(ptCloud.Location(:,3));
nzUnq = numel(zUnq);
zSlices = zUnq(1:500:nzUnq);
Extract all point coordinates that belong to the selected z-values
zIdx = ismember(ptCloud.Location(:,3),zSlices);
ptCloudSegmented = ptCloud.Location(zIdx,:);
Plot results
figure()
pcshow(ptCloudSegmented)
Interpretation 2: segmenting a range of z-values
Read-in the ply file
teapotOut.ply = unzip('teapotOut.zip');
ptCloud = pcread('teapotOut.ply');
List a range of z-values to include in extraction
This demo selects all z-values between 0.8-1.2, inclusive.
zLim = [0.8,1.2];
Extract all point coordinates that belong to the selected z-values
zIdx = ptCloud.Location(:,3)>=zLim(1) & ptCloud.Location(:,3)<=zLim(2);
ptCloudSegmented = ptCloud.Location(zIdx,:);
Plot results
figure()
pcshow(ptCloudSegmented)

댓글 수: 3

thank you so much for you quick answer. Now i will try your tip.
Adam Danz
Adam Danz 2021년 5월 25일
...any luck?
i have to try your tip yet. As soon as i will have some score, i will inform you. Thank you very much.

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

추가 답변 (0개)

카테고리

제품

릴리스

R2021a

질문:

2021년 5월 24일

댓글:

2021년 5월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by