0

我想在使用 Python 可视化 open3D 中的点云时显示坐标。根据文档,我编写了以下代码,其中第三行应该创建一个坐标。(假设point_cache是一个np.array带形状的(442368, 3)

pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(point_cache)
mesh_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=0.6, origin=[-2, -2, -2])
o3d.visualization.draw_geometries([pcd, mesh_frame])

但是它显示了以下错误,表明没有调用create_coordinate_framein的属性TriangleMesh

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-20-2e528bfc7404> in <module>
      1 pcd = o3d.geometry.PointCloud()
      2 pcd.points = o3d.utility.Vector3dVector(point_cache)
----> 3 mesh_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=0.6, origin=[-2, -2, -2])
      4 o3d.visualization.draw_geometries([pcd, mesh_frame])

AttributeError: type object 'open3d.open3d.geometry.TriangleMesh' has no attribute 'create_coordinate_frame'

我想知道为什么会出现此错误,因为第三行与文档相同。

我的open3D版本如下。

[Frost@CC’s Mac ~]$ python3 -m pip show open3d
Name: open3d
Version: 0.8.0.0
Summary: ['Open3D is an open-source library that supports rapid development of software that deals with 3D data.']
Home-page: http://www.open3d.org
Author: Open3D Team
Author-email: info@open3d.org
License: MIT
Location: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requires: notebook, widgetsnbextension, ipywidgets, numpy
Required-by:
4

1 回答 1

3

属性 create_coordinate_frame 不存在;你的意思是create_mesh_coordinate_frame。这对您也不起作用,因为它适用于网格而不是点云。

要查看带有轴的点云,我建议使用 PyGEL 3D(pygel、gel3D、GEL - 都一样)。在 Jupyter 笔记本中试试这个:

from PyGEL3D import gel
from PyGEL3D import js

m = gel.ply_load('filename.ply') # Also try gel.wrl_load() for WRL files ;-)
m_points = m.positions() # Extract (n, 3) array (or list) of n points
js.display(m, smooth=False) # Note we do not need to extract points to view cloud

如果您不使用 Jupyter Notebook,请使用 js.display 删除最后一行。用这个替换它:

viewer = gel.GLManifoldViewer()
viewer.display(m)
于 2020-03-18T20:08:24.213 回答