Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python plyfile vs pymesh

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.

like image 634
Ray Avatar asked Apr 28 '16 16:04

Ray


1 Answers

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:

  • http://www.open3d.org/docs/release/tutorial/Basic/visualization.html
  • http://www.open3d.org/docs/release/tutorial/Basic/working_with_numpy.html
like image 165
Chee Loong Soon Avatar answered Sep 27 '22 19:09

Chee Loong Soon