fwilliams / point-cloud-utils

An easy-to-use Python library for processing and manipulating 3D point clouds and meshes.
https://www.fwilliams.info/point-cloud-utils/
MIT License
1.33k stars 107 forks source link

RuntimeError: Internal PLY loading error. Type has no defined byte size. #99

Open GregorKobsik opened 1 week ago

GregorKobsik commented 1 week ago

Hi,

Description: I tried to load a .PLY file with your library, unfortunately it does not work as intended - resulting in an error: RuntimeError: Internal PLY loading error. Type has no defined byte size.

Version: point-cloud-utils-0.31.0

Workaround: I can still load the files with plydata = PlyData.read(input_file), extract the vertices and faces, and process the data further with your library. Maybe this workaround helps others with a similar issues.

Sincerely, Gregor


I also attached an exemplary file: 22831bc32bd744d3f06dea205edf9704.zip

Meshlab is loading the file correctly: image

Error Log:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[66], line 14
     12 # load cuboid and sample point cloud
     13 print(input_file)
---> 14 cuboid_verts, cuboid_faces = pcu.load_mesh_vf(input_file)

File /clusterstorage/gkobsik/miniforge3/envs/py3d/lib/python3.10/site-packages/point_cloud_utils/_mesh_io.py:640, in load_mesh_vf(filename, dtype)
    627 def load_mesh_vf(filename, dtype=float):
    628     """
    629     Load a triangle mesh consisting of vertex positions and face indices.
    630     Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
   (...)
    638       f : An (m, 3)-shaped integer numpy array of face indices into v
    639     """
--> 640     ret = load_triangle_mesh(filename, dtype=dtype)
    641     return ret.v, ret.f

File /clusterstorage/gkobsik/miniforge3/envs/py3d/lib/python3.10/site-packages/point_cloud_utils/_mesh_io.py:556, in load_triangle_mesh(filename, dtype)
    544 """
    545 Load a triangle mesh into a `TriangleMesh` class.
    546 Point Cloud Utils currently supports PLY, OBJ, STL, OFF, VRML 2.0, X3D, COLLADA, 3DS.
   (...)
    553   mesh : A `TriangleMesh` class containing the loaded mesh
    554 """
    555 ret = TriangleMesh()
--> 556 ret.load(filename, dtype=dtype)
    557 return ret

File /clusterstorage/gkobsik/miniforge3/envs/py3d/lib/python3.10/site-packages/point_cloud_utils/_mesh_io.py:344, in TriangleMesh.load(self, filename, dtype)
    341         os.chdir(previous_dir)
    343 with pushd(mesh_root_path):
--> 344     mesh_dict = load_mesh_internal(mesh_filename, dtype)
    346 self.textures = mesh_dict["textures"]
    347 self.normal_maps = mesh_dict["normal_maps"]

RuntimeError: Internal PLY loading error. Type has no defined byte size.
NIRVANALAN commented 1 week ago

Same error here, but this only happens on py=3.9. using py=3.10 on a same machine resolves this issue.