How to plot patch with point cloud

조회 수: 8 (최근 30일)
Brendan Balken
Brendan Balken 2020년 1월 25일
댓글: Brendan Balken 2020년 1월 28일
Hello MATLAB community!
So I am trying to plot a point cloud in the same plot as a patch. The patch is an enclosed surface and the point cloud should be mostly inside that surface. It works great if I say something like this pseudocode:
g = patch
plot(g)
hold on
h = pcshow(ptCloud)
And that's grand. But I want to add a for loop that plays a timeseries where each time point has a new point cloud in the same space. When I try to change anything, the axes get very messed up and I basically have to replot the entire thing for each time point. If I delete(g) or delete(h) the whole thing disappears. If I try to just say pcshow(ptCloud2) it plots it on top of the other cloud (because is hold on). I don't know enough about plotting patches or pcshow to understand what is happening here. Any insight would be much appreciated. Or if you can come up with a better approach.
Also, bonus points if you can tell me how to get rid of the axes that appear in the center of the plot every time I click and drag to rotate :)
Thanks!!
Brendan

채택된 답변

Brendan Balken
Brendan Balken 2020년 1월 28일
data = csvread(['./ptClouds/' dataName '/' dataName '_1.csv']);
pcshow(pointCloud(data(:,1:3), 'Intensity', data(:,4)), 'MarkerSize', pointSize);
for k=1:numVol
data = csvread(['./ptClouds/' dataName '/' dataName '_' num2str(k) '.csv']);
x = get(fig, 'children');
ax = x(3);
ax.Children(1).XData = data(:,1);
ax.Children(1).YData = data(:,2);
ax.Children(1).ZData = data(:,3);
ax.Children(1).CData = data(:,4);
drawnow
end
So this is what I have for now. It works pretty well. It basically finds the data that defines the point cloud, replaces those values, and redraws the figure. This preserves everything about the axes. At the moment, I'm looking into doing this outside of MATLAB because MATLAB seems very limited for rendering 3d surfaces. So I haven't yet had the chance to try your suggestion John, but it sounds really cool and I want to check it out. If I end up using MATLAB for this, I'll try it out and get back to you. Thanks!!

추가 답변 (1개)

Githin John
Githin John 2020년 1월 28일
편집: Githin John 2020년 1월 28일
From what I understood off your question, it seems like the pcplayer might help with plotting a time series pointCloud. You can use the view function in the loop as shown in the examples from the documentation.
player=pcplayer(...)
patch(player.Axes,...)
  댓글 수: 1
Brendan Balken
Brendan Balken 2020년 1월 28일
Hey John! Thanks for the suggestion! I solved the problem one way (see posted answer). I may not end up usin MATLAB for this, but if I do I'll try pcplayer and get back to you. Thanks!

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

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by