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
{{ message }}
Repository navigation
IO PolygonMesh to PLY output cannot support large polygons #6087
When a polygon is bigger than 256 edges, this results in a ply file which cannot be read by PCL
This Possible Fix
When a polygon contains a large polygon, the simple fix is to change: property list uchar int vertex_indices
to property list uint int vertex_indices
PCL will then be able to read back in this ply file.
However, meshlab (for comparison) cannot load this ply file. VTK can parse it.
Your Environment (please complete the following information):
The existing header:
ply
format ascii 1.0
comment PCL generated
element vertex 1257
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
property float nx
property float ny
property float nz
property float curvature
element face 8
property list uchar int vertex_indices
end_header
The header containing the fix:
ply
format ascii 1.0
comment PCL generated
element vertex 1257
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
property float nx
property float ny
property float nz
property float curvature
element face 8
property list uint int vertex_indices
end_header
PCL will then be able to read back in this ply file.
However, meshlab (for comparison) cannot load this ply file. VTK can parse it.
So the best approach probably is to check whether any face/polygon has more than 255 vertices, if yes use uint (and maybe print a warning), if not use uchar as before.
Feel free to open a pull request.
Activity
mauricefallon commentedon Jul 16, 2024
The existing header:
ply
format ascii 1.0
comment PCL generated
element vertex 1257
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
property float nx
property float ny
property float nz
property float curvature
element face 8
property list uchar int vertex_indices
end_header
The header containing the fix:
ply
format ascii 1.0
comment PCL generated
element vertex 1257
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
property float nx
property float ny
property float nz
property float curvature
element face 8
property list uint int vertex_indices
end_header
mvieth commentedon Jul 17, 2024
Interesting, I did not expect that someone would have faces with more than 255 vertices/edges.
https://github.com/PointCloudLibrary/pcl/blob/master/io/src/ply_io.cpp#L907C32-L907C51 I think this line is actually irrelevant because it is for a
pcl::PCLPointCloud2, not apcl::PolygonMeshand stores no indices. I am not sure though why that line is written at all, probably for compatibility with some ply readers.However these lines would have to be adapted if
ucharis changed touint: https://github.com/PointCloudLibrary/pcl/blob/master/io/src/ply_io.cpp#L1707-L1713 (binary ply)So the best approach probably is to check whether any face/polygon has more than 255 vertices, if yes use
uint(and maybe print a warning), if not useucharas before.Feel free to open a pull request.