Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh Vertices Shape Inconsistency #6939

Open
3 tasks done
Mon-ius opened this issue Aug 30, 2024 · 0 comments
Open
3 tasks done

Mesh Vertices Shape Inconsistency #6939

Mon-ius opened this issue Aug 30, 2024 · 0 comments
Labels
bug Not a build issue, this is likely a bug.

Comments

@Mon-ius
Copy link

Mon-ius commented Aug 30, 2024

Checklist

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

@Mon-ius Mon-ius added the bug Not a build issue, this is likely a bug. label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not a build issue, this is likely a bug.
Projects
None yet
Development

No branches or pull requests

1 participant