본문 바로가기
Computer Vision

[Python] Triangle Mesh to Pointcloud

by wisejlog 2023. 9. 9.

Mesh 를 다룰 때 pytorch3d, open3d 두가지의 3d 라이브러리를 많이 쓰는 편이다.

 

 

Triangle Mesh 가 있는 상황에서 Point Cloud를 뽑아내는 두 라이브러리 함수를 정리해 놓았다.

 

1. Open3D의 Sampling

http://www.open3d.org/docs/release/tutorial/geometry/mesh.html#Sampling

 

Mesh — Open3D 0.17.0 documentation

Open3D has a data structure for 3D triangle meshes called TriangleMesh. The code below shows how to read a triangle mesh from a ply file and print its vertices and triangles. The TriangleMesh class has a few data fields such as vertices and triangles. Open

www.open3d.org

pcd = mesh.sample_points_uniformly(number_of_points=500)

 

2. Pytorch3D '''pytorch3d.ops.sample_points_from_meshes'''

https://pytorch3d.readthedocs.io/en/latest/modules/ops.html#pytorch3d.ops.sample_points_from_meshes

 

pytorch3d.ops — PyTorch3D documentation

volume_features – Output volume of shape (minibatch, feature_dim, D, H, W) volume_densities: Occupancy volume of shape (minibatch, 1, D, H, W) containing the total amount of votes cast to each of the voxels.

pytorch3d.readthedocs.io

pytorch3d.ops.sample_points_from_meshes(meshes, num_samples: int = 10000, return_normals: bool = False, return_textures: bool = False)

'Computer Vision' 카테고리의 다른 글

OpenGL 공부  (0) 2022.12.27
BVH File Format  (0) 2022.08.12