使用Python在线从点云中生成网格

时间:2019-05-16 15:20:26

标签: python numpy python-2.x mesh point-clouds

我会定期通过ROS接收点云数据,我想从这些输入中生成网格。

我在Ubuntu 18上并且使用Python2。有人建议使用Delaunay3D,但我从库中看不到任何示例,显然必须购买本书才能看到这些。

人们真的有办法从点云中构造出网格吗?

P.S:我不是在寻找像Meshlab这样的“软件”,它将在Python代码中使用。

鉴于我具有以下x,y,z点,可以创建网格吗?

array([[ 0.53447372, -0.11848319,  0.05539769],
       [ 0.53447372, -0.11848319,  0.05539769],
       [ 0.53447372, -0.11848319,  0.05539769],
       ...,
       [ 0.53391876, -0.11834809,  0.05456705],
       [ 0.53391876, -0.11834809,  0.05456705],
       [ 0.53391876, -0.11834809,  0.05456705]])

我尝试过类似this的事情:

import numpy as np

# Create data with x and y random in the [-2, 2] segment, and z a
# Gaussian function of x and y.
np.random.seed(12345)
x = 4 * (np.random.random(500) - 0.5)
y = 4 * (np.random.random(500) - 0.5)


def f(x, y):
    return np.exp(-(x ** 2 + y ** 2))

z = f(x, y)
from mayavi import mlab
mlab.figure(1, fgcolor=(0, 0, 0), bgcolor=(1, 1, 1))

# Visualize the points
pts = mlab.points3d(x, y, z, z, scale_mode='none', scale_factor=0.2)

# Create and visualize the mesh
mesh = mlab.pipeline.delaunay2d(pts)
surf = mlab.pipeline.surface(mesh)

mlab.view(47, 57, 8.2, (0.1, 0.15, 0.14))
mlab.show()

但是这种期望的数据样式与我所拥有的完全不同,所以我不断出错。可能不是我要找的东西。也许我以错误的方式使用它。

如果有人能够从接收到的3d点集中构造网格,那么我很想听听。

0 个答案:

没有答案
相关问题