机器人持续学习基准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])


相关推荐
机器人猎头David9 小时前
VLA、世界模型、强化学习,在机器人里分别解决什么问题?
人工智能·机器人·机器人猎头·机器人猎头公司
竞赛考级题库9 小时前
202606 青少年等级考试机器人理论真题一级 建议答题时长:60min(含答案与分析)
机器人
TMT星球11 小时前
大晓发布全球首个可仿真人–场景交互重建框架HSImul3R
人工智能·科技·机器人
hey you~11 小时前
语音机器人可以给老客户做定期关怀回访吗?运营方案参考
机器人·老客户关怀·客户回访·客户关系维护·客户分层
FPC工厂——皇榜科技11 小时前
机器人灵巧手线路板:从“握得住”到“摸得准”:一只机械手的柔性神经密码
网络·人工智能·科技·机器人·pcb工艺
workflower15 小时前
智能体-企业行政问答助手
人工智能·机器学习·机器人·云计算·无人机
tianxuanjg19 小时前
工业/协作机器人研发采购指南:如何适配新品迭代的CNC加工合作
人工智能·经验分享·机器人·无人机·材质
GlobalInfo19 小时前
2026-2032年全球固定相机式工业机器人视觉系统行业产量、产值及主要企业格局分析报告
数码相机·机器人
拓维运动科技20 小时前
机器人性能测试平台:从室外场地到实验室标准化测评的技术路径
机器人·六自由度运动模拟平台·南京拓维运动科技·非标定制机器人动态测试平台·机器人性能测试平台·模拟机器人性能工况
HyperAI超神经20 小时前
机器人运动误差降低90.4%,英伟达/哈佛等提出Hydra-0,用Action Flow统一世界建模与控制
人工智能·深度学习·机器人·英伟达·世界模型