Open3D
Open3D copied to clipboard
Mesh Vertices Shape Inconsistency
Checklist
- [X] I have searched for similar issues.
- [X] For Python issues, I have tested with the latest development wheel.
- [X] I have checked the release documentation and the latest documentation (for
mainbranch).
Describe the issue
The Vertices shape is not consist before and after o3d.io.write_triangle_mesh. The original data store in *.ply, and after convert to *.stl, the mesh.vertices shape changed, but mesh.triangles remains the same.
Steps to reproduce the bug
def export(self, pth: str) -> str:
if not os.path.exists(pth):
os.mkdir(pth)
data_in = self.input.data()
data_out = self.output.data()
points_in = np.asarray(data_in.vertices)
points_out = np.asarray(data_out.vertices)
faces_in = np.asarray(data_in.triangles)
faces_out = np.asarray(data_out.triangles)
print(f"Before, <{points_in.shape} - {faces_in.shape}> || <{points_out.shape} - {faces_out.shape}>")
# o3d.io.write_triangle_mesh(os.path.join(pth, "input.ply"), data_in)
# o3d.io.write_triangle_mesh(os.path.join(pth, "output.ply"), data_out)
# data_in = o3d.io.read_triangle_mesh(os.path.join(pth, "input.ply"))
# data_out = o3d.io.read_triangle_mesh(os.path.join(pth, "output.ply"))
o3d.io.write_triangle_mesh(os.path.join(pth, "input.stl"), data_in)
o3d.io.write_triangle_mesh(os.path.join(pth, "output.stl"), data_out)
data_in = o3d.io.read_triangle_mesh(os.path.join(pth, "input.stl"))
data_out = o3d.io.read_triangle_mesh(os.path.join(pth, "output.stl"))
points_in = np.asarray(data_in.vertices)
points_out = np.asarray(data_out.vertices)
faces_in = np.asarray(data_in.triangles)
faces_out = np.asarray(data_out.triangles)
print(f"After, <{points_in.shape} - {faces_in.shape}> || <{points_out.shape} - {faces_out.shape}>")
return pth
Error message
No response
Expected behavior
No response
Open3D, Python and System information
- Operating system: Ubuntu 22.04
- Python version: Python 3.12
- Open3D version: `0.18.0+a38ec05`
- System architecture: x86
- Is this a remote workstation?: yes
- How did you install Open3D?: conda
Additional information
For example,
o3d.io.write_triangle_mesh(os.path.join(pth, "input.stl"), data_in)
o3d.io.write_triangle_mesh(os.path.join(pth, "output.stl"), data_out)
data_in = o3d.io.read_triangle_mesh(os.path.join(pth, "input.stl"))
data_out = o3d.io.read_triangle_mesh(os.path.join(pth, "output.stl"))
the output is,
Before, <(512, 3) - (885, 3)> || <(508, 3) - (903, 3)>
After, <(2655, 3) - (885, 3)> || <(2709, 3) - (903, 3)>
While,
o3d.io.write_triangle_mesh(os.path.join(pth, "input.ply"), data_in)
o3d.io.write_triangle_mesh(os.path.join(pth, "output.ply"), data_out)
data_in = o3d.io.read_triangle_mesh(os.path.join(pth, "input.ply"))
data_out = o3d.io.read_triangle_mesh(os.path.join(pth, "output.ply"))
the output is,
Before, <(512, 3) - (885, 3)> || <(508, 3) - (903, 3)>
After, <(512, 3) - (885, 3)> || <(508, 3) - (903, 3)>
No response