how do I remove points from the outer edge of a point cloud?

조회 수: 9 (최근 30일)
Joshua Knicely
Joshua Knicely 2021년 12월 16일
답변: Joshua Knicely 2022년 1월 8일
I have several sets of point cloud data. All of them are almost perfectly planar, save for a small indentation near the center (cratering experiments). In a few of these, edge effects cause some of the points along the edge to be lower than the plain. This causes later code to mess up and identify that edge as the center of the crater (see the attached figures).
The simplest thing I can think of is to remove all of the points within some distance of the outer boundary of my point cloud, but I'm having trouble setting that up. The code would look something like this:
radius = 10;
xs = ptCloud(:,1).Location;
ys = ptCloud(:,2).Location;
zs = ptCloud(:,3).Location;
k = boundary(xs,ys);
for i = 1:length(k)
% something that sets points within 'radius' of xs(k), ys(k), & zs(k)
% to NaN
end
% make a temporary point cloud out of my NaNed points
ptCloud_temp = pointCloud([xs,ys,zs]);
ptCloud_new = removeInvalidPoints(ptCloud_temp);
What thoughts do y'all have on how to set those points to NaN?
Is there a better way to do this?
Thanks

채택된 답변

Joshua Knicely
Joshua Knicely 2022년 1월 8일
For anyone else that is interested, here is my (ugly/inefficient) code to do the job.
radius_rm = 40; % radius within edge of point cloud to remove points.
% get the boundary (my data is almost flat in the z direction; this will NOT work for more complex 3D shapes)
k_post = boundary(ptCloud_post.Location(:,1),ptCloud_post.Location(:,2));
% get the points within some radius of the boundary
indices_rm = [];
for i = 1:length(k_post)
[idxs,~] = findNeighborsInRadius(ptCloud_post,ptCloud_post.Location(k_post(i),:),radius_rm);
indices_rm = [indices_rm; idxs];
end
indices_rm = unique(indices_rm);
% remove those points from my ptCloud_post.
temp = ptCloud_post.Location;
ptRemove = ptCloud_post.Location(indices_rm,:);
temp = setdiff(temp,ptRemove,'rows');
ptCloud_post = pointCloud(temp);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Point Cloud Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by