You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How would I convert an STL file to a point cloud file (either .pcd or .ply file)? I have tried reading the STL file as a mesh file and then using the following code to try to convert it to a point cloud, but this does not work.
Using the python package numpy-stl, I did the following to read the mesh: your_mesh = mesh.Mesh.from_file("/../../Open3D/examples/Python/Basic/Dog.stl")
and then your source code: pcd = PointCloud() pcd.points = Vector3dVector(your_mesh) write_point_cloud("../../TestData/test_dog.ply", pcd) pcd_load = read_point_cloud("../../TestData/test_dog.ply") draw_geometries([pcd_load])
but it isn't able to execute the draw_geometries function. Is there another way to import and convert an stl file into a pcd or ply file?
Thanks!
The text was updated successfully, but these errors were encountered:
I tried this and it worked, if you want to convert triangular mesh to point cloud
import open3d as o3d
mesh = o3d.io.read_triangle_mesh("file.stl")
pointcloud = mesh.sample_points_poisson_disk(100000)
# you can plot and check
o3d.visualization.draw_geometries([mesh])
o3d.visualization.draw_geometries([pointcloud])
Hi,
How would I convert an STL file to a point cloud file (either .pcd or .ply file)? I have tried reading the STL file as a mesh file and then using the following code to try to convert it to a point cloud, but this does not work.
Using the python package numpy-stl, I did the following to read the mesh:
your_mesh = mesh.Mesh.from_file("/../../Open3D/examples/Python/Basic/Dog.stl")
and then your source code:
pcd = PointCloud()
pcd.points = Vector3dVector(your_mesh)
write_point_cloud("../../TestData/test_dog.ply", pcd)
pcd_load = read_point_cloud("../../TestData/test_dog.ply")
draw_geometries([pcd_load])
but it isn't able to execute the draw_geometries function. Is there another way to import and convert an stl file into a pcd or ply file?
Thanks!
The text was updated successfully, but these errors were encountered: