Python plyfile vs pymesh

Ray picture Ray · Apr 28, 2016 · Viewed 16.9k times · Source

I need to read, manipulate and write PLY files in Python. PLY is a format for storing 3D objects. Through a simple search I've found two relevant libraries, PyMesh and plyfile. Has anyone had any experience with either of them, and does anyone have any recommendations? plyfile seems to have been dormant for a year now, judging by Github.

I know this question instigates opinion-based answers but I don't really know where else to ask this question.

Answer

Chee Loong Soon picture Chee Loong Soon · Jan 28, 2020

As of (2020 January).

None, use open3d. It's the easiest and reads .ply files directly into numpy.

import numpy as np
import open3d as o3d

# Read .ply file
input_file = "input.ply"
pcd = o3d.io.read_point_cloud(input_file) # Read the point cloud

# Visualize the point cloud within open3d
o3d.visualization.draw_geometries([pcd]) 

# Convert open3d format to numpy array
# Here, you have the point cloud in numpy format. 
point_cloud_in_numpy = np.asarray(pcd.points) 

References: