我有一些顶点,其坐标存储为 NumPy 数组。
xyz_np:
array([[ 7, 53, 31],
[ 61, 130, 116],
[ 89, 65, 120],
...,
[ 28, 72, 88],
[ 77, 65, 82],
[117, 90, 72]], dtype=int32)
Run Code Online (Sandbox Code Playgroud)
我想将这些顶点保存为点云文件(例如 .ply)并在 Blender 中将其可视化。
我没有脸部信息。
我有一个 numpy 数组,它是形状(高度,宽度,3)的彩色图像“img”,也是形状(高度,宽度)的深度 numpy 数组。我想创建一个 RGBD 图像并显示它,为此我正在执行以下操作:
o3d.geometry.RGBDImage.create_from_color_and_depth(img, depth)
Run Code Online (Sandbox Code Playgroud)
但我收到错误:
TypeError: create_from_color_and_depth(): incompatible function arguments. The following argument types are supported:
1. (color: open3d.open3d_pybind.geometry.Image, depth: open3d.open3d_pybind.geometry.Image, depth_scale: float = 1000.0, depth_trunc: float = 3.0, convert_rgb_to_intensity: bool = True) -> open3d.open3d_pybind.geometry.RGBDImage
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?如果需要Image类型,那么如何将numpy数组转换为Image类型?
即使我将 numpy 数组传递到 o3d.geometry.Image 构造函数中,如下所示:
o3d.geometry.RGBDImage.create_from_color_and_depth(o3d.geometry.Image(img), o3d.geometry.Image(depth))
Run Code Online (Sandbox Code Playgroud)
我收到错误:
TypeError: create_from_color_and_depth(): incompatible function arguments. The following argument types are supported:
1. (color: open3d.open3d_pybind.geometry.Image, depth: open3d.open3d_pybind.geometry.Image, depth_scale: float = 1000.0, depth_trunc: float = 3.0, convert_rgb_to_intensity: bool = True) -> open3d.open3d_pybind.geometry.RGBDImage
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题并从 …
我正在使用 Open3D 在 Python 中可视化点云。本质上,我想做的是以编程方式向点云添加另一个点,然后实时渲染它。
这是我到目前为止所拥有的。我找不到任何解决方案。
在下面的代码中,我展示了一种可能的解决方案,但它并不有效。第一个窗口关闭后,点将被添加并打开一个新窗口。这不是我想要的。我希望它能够动态显示新点,而无需再次关闭和打开。以及创建一个新变量的事实,我认为在处理越来越大的数据集时可能会出现问题
import open3d as o3d
import numpy as np
#Create two random points
randomPoints = np.random.rand(2, 3)
pointSet = o3d.geometry.PointCloud()
pointSet.points = o3d.utility.Vector3dVector(randomPoints)
#Visualize the two random points
o3d.visualization.draw_geometries([pointSet])
#Here I want to add more points to the pointSet
#This solution does not work effective
#Create another random set
p1 = np.random.rand(3, 3)
p2 = np.concatenate((pointSet.points, p1), axis=0)
pointSet2 = o3d.geometry.PointCloud()
pointSet2.points = o3d.utility.Vector3dVector(p2)
o3d.visualization.draw_geometries([pointSet2])
Run Code Online (Sandbox Code Playgroud)
有没有可能解决这个问题?
如果没有,我还可以查看哪些其他库能够实时渲染新的传入点。
我已经使用 RGB+深度视频生成了多个点云,并且希望将多个点云可视化为视频或动画。
\n目前我使用的是Python,我的部分代码如下:
\nfor i in range(1,10)\n pcd = Track.create_pcd(i)\n o3d.visualization.draw_geometries([pcd])\n pcd_list.append(pcd)\nRun Code Online (Sandbox Code Playgroud)\n当我使用draw_geometries或draw_geometries_with_animation_callback时,它们似乎无法显示点云列表:
\no3d.visualization.draw_geometries([pcd_list])\nRun Code Online (Sandbox Code Playgroud)\n或者
\ndef rotate_view(vis):\n ctr = vis.get_view_control()\n ctr.rotate(10.0, 0.0)\n return False\n \no3d.visualization.draw_geometries_with_animation_callback([pcd_list],rotate_view)\nRun Code Online (Sandbox Code Playgroud)\n它给出了以下错误:
\n\n\n类型错误:draw_geometries():函数参数不兼容。支持\n以下参数类型:
\n\n
\n- (geometry_list:列表[open3d.open3d_pybind.geometry.Geometry],window_name:str = \xe2\x80\x98Open3D\xe2\x80\x99,宽度:int = 1920,高度:int = 1080,\n左:int = 50,顶部:int = 50,point_show_normal:bool = False,\ nmesh_show_wireframe:bool = False,mesh_show_back_face:bool = False)\ n->无
\n
是否有任何示例说明如何将点云列表导出到视频中,例如设置查看器,并使用 0.5 秒的等待键显示每个点云,然后另存为视频文件(.mp4/.avi)?\n和还要获取然后设置视频中点云的固定视点?
\n非常感谢!
\nOpen3D (Python) 有没有办法为给定的点云设置透明度通道?我已经搜索了很长一段时间,但没有找到任何东西。我在该项目的Github上发现了一个讨论,暗示这是可能的,但我找不到任何示例。
有人知道如何做到这一点吗?
我有一个 3D 模型 (.obj) 纹理,可以在其他软件中正确加载:

这是我正在使用的代码:
import open3d as o3d
def visualize(mesh):
vis = o3d.visualization.Visualizer()
vis.create_window()
vis.add_geometry(mesh)
vis.run()
vis.destroy_window()
def main():
mesh = o3d.io.read_triangle_mesh("scene_mesh_decimated_textured.obj")
visualize(mesh)
main()
Run Code Online (Sandbox Code Playgroud)
这是模型和纹理: https://www.dropbox.com/s/xm0sun3hoijwbjf/Archive.zip ?dl=0
社区,
\n我正在尝试使用 Open3D 将点云与检测到的地板对齐。到目前为止,我实施了以下步骤(此答案的一部分):
\nget_rotation_matrix_from_axis_angle(参见3)结果还不错,但我必须在最后使用优化因子以获得更好的结果。是否有错误或更简单/更精确的对齐方式?
\n# See functions below\n\n# Get the plane equation of the floor \xe2\x86\x92 ax+by+cz+d = 0\nfloor = get_floor_plane(pcd)\na, b, c, d = floor\n\n# Translate plane to coordinate center\npcd.translate((0,-d/c,0))\n\n# Calculate rotation angle between plane normal & z-axis\nplane_normal = tuple(floor[:3])\nz_axis = (0,0,1)\nrotation_angle = vector_angle(plane_normal, z_axis)\n\n# Calculate rotation axis\nplane_normal_length = …Run Code Online (Sandbox Code Playgroud) 我正在尝试用代表锥束 CT 图像的器官轮廓数据的点云创建一个防水网格。我的目标是获取两个网格并计算它们两个之间的相交体积。
我尝试过使用此处显示的每种方法
point_cloud = np.genfromtxt('ct_prostate_contour_data.csv', delimiter=',')
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(point_cloud)
pcd.compute_convex_hull()
pcd.estimate_normals()
pcd.orient_normals_consistent_tangent_plane(10)
mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, depth=10, width=0, scale=20, linear_fit=True)[0]
mesh.compute_vertex_normals()
mesh.paint_uniform_color([0.5, 0.5, 0.5])
mesh.remove_degenerate_triangles()
o3d.visualization.draw_geometries([pcd, mesh], mesh_show_back_face=True)
Run Code Online (Sandbox Code Playgroud)
虽然这个方法在我看来似乎会产生一个水密网格,但 mesh.is_watertight() 的结果是 False,但是对于膀胱数据它返回 True。此外,该算法将网格扩展到数据垂直限制的上方和下方。虽然这并不是一个破坏交易的问题,但如果有一种方法可以最大限度地减少它,那就太好了。
泊松网格图像

point_cloud = np.genfromtxt('ct_prostate_contour_data.csv', delimiter=',')
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(point_cloud)
pcd.compute_convex_hull()
pcd.estimate_normals()
pcd.orient_normals_consistent_tangent_plane(30)
distances = pcd.compute_nearest_neighbor_distance()
avg_dist = np.mean(distances)
radii = [0.1*avg_dist, 0.5*avg_dist, 1*avg_dist, 2*avg_dist]
r = o3d.utility.DoubleVector(radii)
rec_mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_ball_pivoting(pcd, r)
o3d.visualization.draw_geometries([pcd, rec_mesh], mesh_show_back_face=True)
Run Code Online (Sandbox Code Playgroud)
如果我能够填充孔,这将是我的首选方法,因为它只是连接顶点而无需插值。也许如果我能够使其进入仅剩下的孔很大的状态,我可以将该网格转换为 Pyvista 兼容的网格并使用 Pymeshfix …
我在Windows 10中使用pyCharm软件,当我尝试安装open3d时出现以下错误:
ERROR: Could not find a version that satisfies the requirement open3d (from versions: none)
ERROR: No matching distribution found for open3d
Run Code Online (Sandbox Code Playgroud)
我尝试使用cmd安装它,但出现了同样的错误,pip版本也是20.1.1。

import open3d as o3d
print("Let's draw a box using o3d.geometry.LineSet.")
points = [
[0, 0, 0],
[1, 0, 0],
[0, 1, 0],
[1, 1, 0],
[0, 0, 1],
[1, 0, 1],
[0, 1, 1],
[1, 1, 1],
]
lines = [
[0, 1],
[0, 2],
[1, 3],
[2, 3],
[4, 5],
[4, 6],
[5, 7],
[6, 7],
[0, 4],
[1, 5],
[2, 6],
[3, 7],
]
colors = [[1, 0, 0] for i in range(len(lines))]
line_set = o3d.geometry.LineSet( …Run Code Online (Sandbox Code Playgroud)