[Python] Why can't get the correct point clouds from depth map?

Discussão em 'Python' iniciado por Stack, Maio 4, 2025.

  1. Stack

    Stack Membro Participativo

    My depth map is generated by blender.Here are the relevant settings of blender.

    [​IMG]

    This is my main scene.

    [​IMG]
    Here is the depth map:

    [​IMG]
    My code here:

    import cv2
    import numpy as np
    import open3d as o3d

    f_x = 1111.11
    f_y = 1111.11
    c_x = 400
    c_y = 400

    depth_map = cv2.imread("./images/depth.png", cv2.IMREAD_ANYDEPTH)
    height, width = depth_map.shape

    z_min = 4.0
    z_max = 16.0

    point_cloud = []

    for v in range(height):
    for u in range(width):
    d_norm = depth_map[v, u] / 65535.0

    z = d_norm * (z_max - z_min) + z_min
    if z > 0:
    X = (u - c_x) * z / f_x
    Y = (v - c_y) * z / f_y

    point_cloud.append(np.array([X, Y, z]))

    point_cloud = np.array(point_cloud)

    pcd = o3d.geometry.PointCloud()

    pcd.points = o3d.utility.Vector3dVector(point_cloud)

    o3d.visualization.draw_geometries([pcd])



    The reconstruction is terrible, with inexplicable distortions. Camera sensor fit sets Vertical 36x36, picture resolution 800x800

    [​IMG]
    It should actually be a flat surface.

    Continue reading...

Compartilhe esta Página