Skip to content

detect_planar_patches fails with perfectly flat surfaces #6550

@chisarie

Description

@chisarie

Checklist

Describe the issue

I have a point cloud from a simulated cube, which is perfectly flat. I want to use the function detect_planar_patches to find the faces of the cube from the point cloud. Unfortunately the returned patches are wrong, I only get two small patches on one of the faces. The interesting part is that, if I add small random noise to the point cloud, the returned patches are correct again! You can download the ply file to reproduce the issue here: cube_pcd.ply
See the images:

Default pcd:
Screenshot from 2023-12-26 12-06-17

Noisy pcd:
Screenshot from 2023-12-26 12-06-35

Steps to reproduce the bug

import numpy as np
import open3d as o3d

cube_pcd = o3d.io.read_point_cloud("cube_pcd.ply")
patches = cube_pcd.detect_planar_patches()
o3d.visualization.draw_geometries([cube_pcd] + patches)

# Create a new PointCloud with noisy points
cube_points = np.array(cube_pcd.points)
noisy_points = cube_points + np.random.normal(0, 0.001, size=cube_points.shape)
noisy_pcd = o3d.geometry.PointCloud(o3d.utility.Vector3dVector(noisy_points))
noisy_pcd.estimate_normals()
noisy_pcd.orient_normals_towards_camera_location()
new_patches = noisy_pcd.detect_planar_patches()
o3d.visualization.draw_geometries([noisy_pcd] + new_patches)

Error message

No response

Expected behavior

No response

Open3D, Python and System information

- Operating system: Ubuntu 20.04
- Python version: Python 3.9
- Open3D version: tried both latest and 0.17.0
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip inside a conda env

Additional information

No response

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