机器人持续学习基准LIBERO系列7——计算并可视化点云

0.前置

1.前置代码

2.重新获取真实深度信息

  • 之前的由于要显示,进行了整数化处理,所以重新获取一下原始真实深度信息
python 复制代码
from robosuite.utils.camera_utils import get_real_depth_map
agentview_depth_real = get_real_depth_map(env.sim, agentview_depth)

3.获取图像尺寸

python 复制代码
h,w = env_args['camera_heights'],  env_args['camera_widths']

4.创建像素点序列和颜色序列

python 复制代码
i = np.zeros([h*w,2])#(点数,像素点二维坐标)
colors = np.zeros([h*w,3])#(点数,像素点对应的RGB值)
for x in range(h):
    for y in range(w):
        i[x*h+y] = [x,y]
        colors[x*h+y] = agentview_image[x,y]

5.获取相机内外参

python 复制代码
from robosuite.utils.camera_utils import get_camera_extrinsic_matrix,get_camera_intrinsic_matrix

camera_intrinsic_matrix_ = np.linalg.inv(get_camera_intrinsic_matrix(env.sim,'agentview', env_args['camera_heights'],  env_args['camera_widths']))
camera_extrinsic_matrix_ = np.linalg.inv(get_camera_extrinsic_matrix(env.sim,'agentview'))

6.计算世界坐标系下三维点坐标

python 复制代码
points = np.zeros([i.shape[0],3])
for num,p in enumerate(i):
    p_ = (camera_intrinsic_matrix_@np.array([[p[0],p[1],1]]).T).T
    p_[0,2] = agentview_depth_real[int(p[0]),int(p[1])]
    p_ = (camera_extrinsic_matrix_@np.array([p_[0,0],p_[0,1],p_[0,2],1]).T).T
    points[num] = p_[:-1]
print(points)

7.关闭环境

python 复制代码
env.close()
  • 不关闭环境,就是用open3d显示的话,会报错
bash 复制代码
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  183
  Current serial number in output stream:  183

8.open3d显示点云

python 复制代码
import open3d as o3d
pcd_show = o3d.geometry.PointCloud()
pcd_show.points = o3d.utility.Vector3dVector(points[:, :3])
pcd_show.colors = o3d.utility.Vector3dVector(colors[:]/255)
o3d.visualization.draw_geometries([pcd_show])


相关推荐
派大鑫wink1 天前
硬核解析:英伟达机器人的技术内核与落地场景全攻略硬核解析:英伟达机器人的技术内核与落地场景全攻略
机器人
星期五不见面1 天前
机器人学习!(二)ROS-基于Gazebo项目-YOLO(3)2026/01/13
人工智能·学习·机器人
小康小小涵1 天前
WSL2安装移植到F盘并集成ubuntu20的ros-noetic
人工智能·机器人·自动驾驶
热爱专研AI的学妹1 天前
用n8n搭建新闻推送简报机器人:数眼智能搜索+网页阅读API实战指南
机器人
具身智能之心1 天前
ImaginationPolicy:迈向通用、精确、可靠的机器人操作端到端策略
机器人·端到端·具身智能
Deepoch1 天前
从“机械执行”到“意图理解”:Deepoc如何重塑人机交互新范式
人工智能·机器人·开发板·具身模型·deepoc
码农三叔1 天前
(9-2-01)自动驾驶中基于概率采样的路径规划:基于Gazebo仿真的路径规划系统(1)
人工智能·机器学习·机器人·自动驾驶·路径规划
富唯智能1 天前
人形机器人 | 富唯智能具身智能赋能工业柔性制造
机器人·制造
智慧医院运行管理解决方案专家1 天前
平安医院 智守心安 | AI智能巡逻机器人 全时域守护日志
人工智能·机器人
Deepoch1 天前
Deepoc具身模型开发板:让采摘机器人成为果园的“智能农艺师“
人工智能·机器人·农业·采摘机器人·具身模型·deepoc·采摘