How to segment/partition point cloud into upper and lower layers?

This problem has been troubling me for long. I have attached a dataset of unorganized point cloud. It is the partial surface of a cartilage, and it's clear that it has upper and lower surfaces. Now I'd like to use Matlab to divide the point cloud into upper and lower parts, any idea how I could do this? I thought about local search method grid by grid then separating them from the mid-plane. But this method seems very limited and doesn't work well for dataset with a severe slope.
Alternatively, I could look to segment a contour slice of it into upper and lower part. I just need a rough segmentation, the left and right end points don't matter much. After segmentation, I'd do a B-Spline surface approximation.
Any ideas? Thanks in advance!

Answers (1)

Assuming you have (x,y,z) coordinates and want to find points above and below some specified z value:
zDivider = -41; % Dividing line between upper and lower points.
lowerPointsIndexes = z < zDivider; % Logical index.
% Now extract out x, y, and z for the lower part
xLower = x(lowerPointsIndexes);
yLower = y(lowerPointsIndexes);
zLower = z(lowerPointsIndexes);
% Now do for the upper points:
upperPointsIndexes = z >= zDivider; % Logical index.
% Now extract out x, y, and z for the lower part
xUpper = x(upperPointsIndexes);
yUpper = y(upperPointsIndexes);
zUpper = z(upperPointsIndexes);

4 Comments

Thank you for your response.
In my case, the dividing element is not just a horizontal line, it should be a curved line/plane along the shape of the point cloud. I guess I'll still have to do it locally using the method you have suggested.
In that case, I'd scan along the long direction (let's call it the x direction) and get a slab of a few slices, like from x-3 to x+3 as you change x. Then get the y,z coordinates , perhaps take the convex hull or activecontour, and get the centroid of that cross section. Now you'll have the "centerline" of the long blob as a function of x. The point will sort of go along the middle of the blob. Then you can use the code like I had to take points with z values above and below the centerline's z value.
Hi, i have a similar question. I have got a point cloud crown tree and i need slicing along z direction with with 10 cm thickness. Is there a way to create a list ? my aim is to compute the volume with alpha shape concern each singular slice.
Thank you so much
Not sure what you have. Do you have a 3-D volumetric image where the voxel value is 1 if a tree occupies that voxel? Do you just want to get the top most z value for every (x,y) coordinate? And then maybe fill in some "holes" where the top most z value is way down near the middle or bottom of the tree? If so, attach your variable in a .mat file.

Sign in to comment.

Asked:

on 5 Apr 2017

Commented:

on 7 Mar 2022

Community Treasure Hunt

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

Start Hunting!