DepthAnything / Depth-Anything-V2

[NeurIPS 2024] Depth Anything V2. A More Capable Foundation Model for Monocular Depth Estimation
https://depth-anything-v2.github.io
Apache License 2.0
3.86k stars 336 forks source link

得到的一张深度图转点云,可视化异常,希望得到帮助! #134

Open chenqi13814529300 opened 3 months ago

chenqi13814529300 commented 3 months ago

这是我的原始图片 0000 这是run.py的代码,我就注释了关于通道部分 image 这是得到的深度图 0000 这是我将深度图转换为三维点云的代码 `import cv2 import numpy as np import open3d as o3d

depth_path = '/media/kj/2B9747BF3C0EC4D0/Project/RTG-SLAM-Test/data/Ours100ai/hotel/depth/0000.png' depth_image = cv2.imread(depth_path, cv2.IMREAD_UNCHANGED)

print(f"深度图最小值: {depth_image.min()}") print(f"深度图最大值: {depth_image.max()}")

depth_image_float = depth_image.astype(np.float32)

depth_o3d = o3d.geometry.Image(depth_image_float)

w = depth_image.shape[1] h = depth_image.shape[0] fx = 605.3711 fy = 605.2457 cx = 335.3086 cy = 366.51

intrinsic = o3d.camera.PinholeCameraIntrinsic(w, h, fx, fy, cx, cy)

point_cloud = o3d.geometry.PointCloud.create_from_depth_image( depth_o3d, intrinsic )

o3d.visualization.draw_geometries([point_cloud]) ` 这是上述代码可视化点云的图片 image