Skip to content

PointCloud.detect_planar_patches() Crushes When the PointCloud has 10 or more Points with the Same Coordinates #6727

@organic-nailer

Description

@organic-nailer

Checklist

Describe the issue

I tried to use PointCloud.detect_planar_patches() to detect planes from point cloud data. However, I noticed that it crashes the Python kernel when the coordinate data of PointCloud meets a certain condition. If PointCloud has 10 or more points with the same XYZ coordinates, PointCloud.detect_planar_patches() crashes the kernel (no error message is displayed).

Steps to reproduce the bug

import open3d as o3d
import numpy as np

pcd = o3d.geometry.PointCloud()
# define two planes
plane_a = np.random.rand(1000, 3)
plane_a[:, 2] *= 0.01
plane_b = np.random.rand(1000, 3)
plane_b[:, 1] *= 0.01
plane_b[:, 1] += 0.5

# prepare 10 points with the same coordinates
plane_b[:10, :] = [0, 1, 2]
pcd.points = o3d.utility.Vector3dVector(np.vstack((plane_a, plane_b)))

pcd.estimate_normals(search_param=o3d.geometry.KDTreeSearchParamKNN(knn=30))

# then crash here!
planar_boxes = pcd.detect_planar_patches()

print(planar_boxes)

geometries = [pcd]
for i, plane in enumerate(planar_boxes):
    mesh = o3d.geometry.TriangleMesh.create_from_oriented_bounding_box(plane, scale=[1,1,0.0001])
    mesh.paint_uniform_color(plane.color)
    geometries.append(mesh)
    geometries.append(plane)

o3d.visualization.draw_geometries(geometries)

Error message

No response

Expected behavior

No response

Open3D, Python and System information

- Operating system: Windows 11 64-bit
- Python version: Python 3.8.19
- Open3D version: 0.18.0
- System architecture: x86 (AMD Ryzen 4500)
- Is this a remote workstation?: no
- How did you install Open3D?: pip in a conda environment

Additional information

When I execute it on Jupyter Notebook, I received following error log and python kernel was crushed:

[error] Disposing session as kernel process died ExitCode: 3221225725, Reason:
21:13:04.624 [info] Dispose Kernel process 22812.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot a build issue, this is likely a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions