在matlab中绘制3D云的表面 [英] Draw surface of 3D cloud in matlab

查看:37
本文介绍了在matlab中绘制3D云的表面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 3D 点云.我需要将它们绘制为曲面.我尝试了使用 meshdrid、griddata、scatteredInterpolant、trisurf-delaunay 的变体.没有任何作用.我知道这个问题讨论了很多,但似乎我不明白一些重要的细节.我现在拥有的代码:

load('coords.mat')数字()子图(1,2,1)plot3(x,y,z,'.')轴关闭视图(3)子图(1,2,2)C=灰色(数字(x));% 不成功的尝试[~,idx]=sort(z);%      具有C=C(idx,:);% 照度scatter3(x,y,z,50,C,'填充')轴关闭视图(3)

生成以下图像:

你能帮我吗:

1) 找到一种用曲面函数绘制它的方法.

因为有些点可能在表面内部(可能是我的问题)

2) 如何去除不可见"的点?

我需要针对不同情况的解决方案,图片和数据只是一个例子.

Mat 文件可以在

坐标位于此处.

解决方案

你从哪里得到这些数据?它表示为向量,但如果您将其重塑为矩阵,则可以使用 surf 函数.试试这个代码:

z=reshape(z,100,100);y=reshape(y,100,100);x=reshape(x,100,100);冲浪(x,y,z)

I have 3D cloud of dots. I need to plot them as a surface. I tried variant with meshdrid, griddata, scatteredInterpolant,trisurf-delaunay. Nothing works. I know that this question was discussed a lot, but it seems I don't understand some important details. The code which i have now:

load('coords.mat')
figure()
subplot(1,2,1)
plot3(x,y,z,'.')
axis off
view(3)

subplot(1,2,2)
C=gray(numel(x)); % unsuccessful attempt
[~,idx]=sort(z);  %      to have 
C=C(idx,:);       %    illumination
scatter3(x,y,z,50,C,'filled')
axis off
view(3)

produces the following image:

Could you help me:

1) to find a way to draw it with surface function.

and as some dots may be inside the surface (may be it is my problem)

2) How to remove 'invisible' dots?

I need solution for different cases, picture and data presents just an example.

Mat file may be downloaded here.

P.S.

In case it is important – I obtain coordinates of this dots as a rotation of random bezier curve.

UPDATE

In case data above is too big I generate another set with smaller amount of dots:

Coordinates are here.

解决方案

where do you get this data from? It is represented as vectors but if you reshape it to matrices you can use the surf function. Try this code:

z=reshape(z,100,100);
y=reshape(y,100,100);
x=reshape(x,100,100);
surf(x,y,z)

这篇关于在matlab中绘制3D云的表面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆