机器人持续学习基准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_ = ([email protected]([[p[0],p[1],1]]).T).T
    p_[0,2] = agentview_depth_real[int(p[0]),int(p[1])]
    p_ = ([email protected]([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])


相关推荐
脑极体1 小时前
开源鸿蒙,给机器人带来了什么?
华为·机器人·开源·harmonyos
放羊郎7 小时前
2025年首届人形机器人半程马拉松比赛(附机器人照片)
机器人·具身智能·人形机器人·半程马拉松·北京亦庄
一RTOS一8 小时前
鸿道操作系统Type 1虚拟化:破局AI机器人与智能汽车的“安全”与“算力”双刃剑
人工智能·机器人·汽车·鸿道intewell操作系统·工业os
Mr.Winter`10 小时前
无人船 | 图解基于PID控制的路径跟踪算法(以欠驱动无人艇Otter为例)
人工智能·算法·机器人·自动驾驶·ros·ros2·无人船
淮北49414 小时前
ROS机器人开发实践->机器人建模与仿真
学习·机器人·自动驾驶·信息与通信·信号处理
264玫瑰资源库1 天前
嘻游后台系统与机器人模块结构详解:功能逻辑 + 定制改造实战
机器人
深圳信迈科技DSP+ARM+FPGA1 天前
基于龙芯 2K1000处理器和复旦微 FPGA K7 的全国产RapidIO 解决方案研究
嵌入式硬件·fpga开发·机器人·信号处理
kuan_li_lyg1 天前
MATLAB - 小车倒立摆的非线性模型预测控制(NMPC)
开发语言·算法·matlab·机器人·mpc·模型预测控制·倒立摆
LitchiCheng1 天前
复刻低成本机械臂 SO-ARM100 3D 打印篇
人工智能·机器人
硅谷秋水1 天前
Scenario Dreamer:用于生成驾驶模拟环境的矢量化潜扩散模型
人工智能·深度学习·机器学习·计算机视觉·机器人