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

"pcl.paint_uniform_color" gives segmentation fault. #6845

Closed
3 tasks done
Mauhing opened this issue Jun 28, 2024 · 3 comments · Fixed by #6874
Closed
3 tasks done

"pcl.paint_uniform_color" gives segmentation fault. #6845

Mauhing opened this issue Jun 28, 2024 · 3 comments · Fixed by #6874
Labels
bug Not a build issue, this is likely a bug.

Comments

@Mauhing
Copy link

Mauhing commented Jun 28, 2024

Checklist

Describe the issue

"pcl.paint_uniform_color" gives segmentation fault

Steps to reproduce the bug

import open3d as o3d
import numpy as np
import sys

print("Open3D version: {}".format(o3d.__version__))
print("Python version: {}".format(sys.version))

def check_properties(mesh):
    # From: http://www.open3d.org/docs/release/tutorial/geometry/mesh.html
    mesh.compute_vertex_normals()

    edge_manifold = mesh.is_edge_manifold(allow_boundary_edges=True)
    vertex_manifold = mesh.is_vertex_manifold()
    self_intersecting = mesh.is_self_intersecting()
    watertight = mesh.is_watertight()
    orientable = mesh.is_orientable()

    print(f"  edge_manifold:          {edge_manifold}")
    print(f"  vertex_manifold:        {vertex_manifold}")
    print(f"  self_intersecting:      {self_intersecting}")
    print(f"  watertight:             {watertight}")
    print(f"  orientable:             {orientable}")

    geoms = [mesh]
    if not vertex_manifold:
            print("1")
            verts = np.asarray(mesh.get_non_manifold_vertices())
            print("1")
            pcl = o3d.geometry.PointCloud(
                points=o3d.utility.Vector3dVector(np.asarray(mesh.vertices)[verts]))
            print("1")
            pcl.paint_uniform_color((0.0, 0.0, 1.0)) # segmentation fault
            print("1")
            geoms.append(pcl)
    print("Visualizing the mesh and non-manifold vertices in blue.")
    o3d.visualization.draw_geometries(geoms, mesh_show_back_face=True)
    assert edge_manifold, 'The triangle mesh is not edge-manifold.'

def load_and_visualize_mesh(file_path):
    # Load the triangle mesh
    mesh = o3d.io.read_triangle_mesh(file_path)
    check_properties(mesh)

file_path = "mesh.ply"  # Replace this with the path to your mesh file
load_and_visualize_mesh(file_path)

Error message

Open3D version: 0.18.0
Python version: 3.9.19 (main, May 6 2024, 19:43:03)
[GCC 11.2.0]
edge_manifold: True
vertex_manifold: False
self_intersecting: True
watertight: False
orientable: True
1
1
1
Segmentation fault (core dumped)

Expected behavior

Change the color of the point

Open3D, Python and System information

- Operating system: Pop!_OS 22.04 
- Python version: Python 3.9.12 
- Open3D version: 0.18.0 
- System architecture: x86_64 x86_64 x86_64 GNU/Linux
- Is this a remote workstation?: no
- How did you install Open3D?: pip

Additional information

To download my mesh. 2MB
https://drive.google.com/file/d/1eRWxaxAdx6IZKF1VaswgQqO1i45Fr5qr/view?usp=sharing

@Mauhing Mauhing added the bug Not a build issue, this is likely a bug. label Jun 28, 2024
@Wnukx
Copy link

Wnukx commented Jul 10, 2024

Seems to be an issue with numpy2. Try using an earlier version (I tried using numpy1.26 where it worked and numpy2.0.0 didn't).

@ssheorey
Copy link
Member

Verified fixed after upgrading pybind11 to v2.13.1

Open3D version: 0.18.0+c9f671323
Python version: 3.10.4 (main, Jul 15 2022, 18:12:19) [Clang 12.0.0 (clang-1200.0.32.29)]
  edge_manifold:          True
  vertex_manifold:        True
  self_intersecting:      False
  watertight:             False
  orientable:             True
Visualizing the mesh and non-manifold vertices in blue.

@ssheorey ssheorey mentioned this issue Jul 16, 2024
9 tasks
@martinrebane
Copy link

Thanks! This was a lifesaver. I got "Segmentation fault (core dumped)" when using utility.Vector3dVector and was already pulling my hair. If there is anyone else looking for a fix while the open3d pip package still has the issue then you need to:
pip install --force-reinstall numpy==1.26.4

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

Successfully merging a pull request may close this issue.

4 participants