问题描述
我已经在c ++中看到了很多关于如何将3d点云转换为深度图的opencv代码,其中包含照相机内部函数(矩阵以及宽度,高度,fx,fy,cx和cy),但是我有没有看到任何有关使用python将点云转换为深度图的代码。我尝试过使用open3d,它在从深度图转换为点云时效果很好,但是从点云转换为深度图时,会得到一个随机缩放的热图,因此当我从深度图重新导入到open3d中的点云,深度图不正确(因为我必须从热图转换为深度图),并且深度图与rgb图像不对齐。 这是我在open3d中将rgb和depthmap转换为open3d中的点云的代码吗?
intrinsics = o3d.camera.PinholeCameraIntrinsic(640,480,525.0,319.5,239.5)
'''
width (int) – Width of the image.
height (int) – Height of the image.
fx (float) – X-axis focal length
fy (float) – Y-axis focal length.
cx (float) – X-axis principle point.
cy (float) – Y-axis principle point.
'''
depth_raw = o3d.io.read_image("./00000.png")
color_raw = o3d.io.read_image("./color.jpg")
rgbd_image = create_rgbd_image_from_color_and_depth(
color_raw,depth_raw)
pcd = o3d.geometry.create_point_cloud_from_rgbd_image(rgbd_image,o3d.camera.PinholeCameraIntrinsic(intrinsics))
pcd.transform([[1,0],[0,-1,1]]) # flips to it is right side up
o3d.visualization.draw_geometries([pcd])
np.savetxt("./pcd.txt",np.asarray(pcd.points))
有人可以通过代码在opencv或任何其他库中用python帮助我将点云投影到深度图上吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)