isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.23k stars 2.28k forks source link

Problem of plane segmentation #5998

Closed wzx16 closed 1 year ago

wzx16 commented 1 year ago

Checklist

My Question

Hi, I tried to use the plane_segment function to segment plane from the point clouds built by the attached color and depth image. I found the inlier indices include all of the points, which is definitely incorrect. I attached the visualization, code and files below.

import numpy as np
import matplotlib.pyplot as plt
import open3d as o3d
from open3d import geometry

intrinsic = o3d.io.read_pinhole_camera_intrinsic('./demo/intrinsic.json')
color = np.load('color.npy', allow_pickle=True)
depth = np.load('depth.npy', allow_pickle=True)
color, depth = geometry.Image(color), geometry.Image(depth)
rgbd = geometry.RGBDImage.create_from_color_and_depth(color, depth, 1.0)
pcd = geometry.PointCloud.create_from_rgbd_image(rgbd, intrinsic)

plane, inliers = pcd.segment_plane(distance_threshold=3, ransac_n=3, num_iterations=1000)
inlier_cloud = pcd.select_by_index(inliers)
inlier_cloud.paint_uniform_color([0.5, 0, 0])
outlier_cloud = pcd.select_by_index(inliers, invert=True)
o3d.visualization.draw_geometries([inlier_cloud, outlier_cloud])

image

Image files (please unzip it to the same dir as the code provided): imgs.zip

wzx16 commented 1 year ago

Problem resolved, turns out to be I set the point cloud units from milimeter to meter.