isl-org / Open3D

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

How to filter out weird background artifact in Poisson surface reconstruction? #6142

Open CDG-c0de opened 1 year ago

CDG-c0de commented 1 year ago

Checklist

My Question

I wanted to write this question on the Open3D forum, but the activation mail for my account never arrived, checked my spam as well, and had it resent. Nothing..... I am using Azure Kinect cameras to create a face mesh, first I create a point cloud from the RGB-D image. Which I then apply the Poisson surface reconstruction to. However after the surface reconstruction this weird square like artifact shows up in the mesh:

Mesh front view Mesh side view In the point clouds this artifact doesn't show:

Point cloud Point cloud with normals

I think there might be some sort of canvas defined that the poisson reconstruction tries to fill, but this doesn't show in the point clouds. Maybe cropping the point clouds might solve this, but as far as I am aware this would need manual user input, which isn't allowed for the application that I'm making. It has to be automated. Does anyone know how this problem can be solved?



The code I'm using:

def depth_to_point_cloud(): 

    # Load JSON files 
    with open('intrinsic1.json') as f:
        intrinsic_json_1 = json.load(f)

    test_img = imageio.v2.imread("color1.jpg")
    height, width = test_img.shape[:2]

    # Load color and depth images
    col_img_1 = open3d.io.read_image("color1.jpg")
    dep_img_1 = open3d.io.read_image("depth1.png")

    # Create RGBD images
    rgbd1 = open3d.geometry.RGBDImage.create_from_color_and_depth(col_img_1, dep_img_1, convert_rgb_to_intensity = False)

    # Create pinhole cameras
    phc = open3d.camera.PinholeCameraIntrinsic(width, height, intrinsic_json_1["intrinsic_matrix"][2], intrinsic_json_1["intrinsic_matrix"][3], intrinsic_json_1["intrinsic_matrix"][0], intrinsic_json_1["intrinsic_matrix"][1])

    # Create point clouds
    pcd = open3d.geometry.PointCloud.create_from_rgbd_image(rgbd1, phc)

    pcd.transform([[1,0,0,0],[0,-1,0,0],[0,0,-1,0],[0,0,0,1]])
    pcd.estimate_normals(search_param=open3d.geometry.KDTreeSearchParamHybrid(radius=0.1, max_nn=30))
    pcd.orient_normals_consistent_tangent_plane(100)
    mesh, _ = open3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, 9)
    open3d.visualization.draw_geometries([mesh], mesh_show_back_face=True)
rtviii commented 8 months ago

Same problem here. Only interested in the object in the middle, yet there is this sheet-like artifact, which does not show up in the point cloud.

Using a combination of open3d and pyvista.

image

rtviii commented 8 months ago

Related: https://github.com/mkazhdan/PoissonRecon/issues/169