当前位置: 首页 > news >正文

宇树Unitree G1机器人摄像机获取

选择librealscense获取摄像头数据
编译命令:

gitclone https://github.com/IntelRealSense/librealsense.gitcdlibrealsensemkdirbuild&&cdbuild cmake..-DBUILD_EXAMPLES=ONmake-j$(nproc)sudomakeinstall

如果不需要可视化界面可以

cmake..-DBUILD_EXAMPLES=OFF-DBUILD_GRAPHICAL_EXAMPLES=OFF

(可视化界面的编译非常慢)
获取RGB和深度图像的python代码:

importpyrealsense2asrsimportnumpyasnpimportcv2 pipeline=rs.pipeline()config=rs.config()config.enable_stream(rs.stream.color,640,480,rs.format.bgr8,30)config.enable_stream(rs.stream.depth,640,480,rs.format.z16,30)profile=pipeline.start()try:whileTrue:frames=pipeline.wait_for_frames()color_frame=frames.get_color_frame()depth_frame=frames.get_depth_frame()ifnotcolor_frameornotdepth_frame:continuecolor_image=np.asanyarray(color_frame.get_data())depth_image=np.asanyarray(depth_frame.get_data())save_path1='rgb.png'save_path2='depth.png'cv2.imwrite(save_path1,color_image)cv2.imwrite(save_path2,depth_image)break# cv2.imshow('G1 RGB', color_image)#if cv2.waitKey(1) == 27:# breakfinally:pipeline.stop()

获取点云数据的python代码:

importpyrealsense2asrs pipeline=rs.pipeline()config=rs.config()config.enable_stream(rs.stream.depth,640,480,rs.format.z16,30)config.enable_stream(rs.stream.color,640,480,rs.format.bgr8,30)profile=pipeline.start()align=rs.align(rs.stream.color)pc=rs.pointcloud()try:for_inrange(30):# 等自动曝光稳定pipeline.wait_for_frames()frames=pipeline.wait_for_frames()# 如果用了对齐,先 align 再取帧align=rs.align(rs.stream.color)aligned_frames=align.process(frames)depth_frame=aligned_frames.get_depth_frame()color_frame=aligned_frames.get_color_frame()ifnotdepth_frameornotcolor_frame:raiseRuntimeError("Depth or Color frame is missing!")# ✅ 关键:显式转换为 video_framecolor_vframe=color_frame.as_video_frame()pc=rs.pointcloud()pc.map_to(color_vframe)# ✅ 传 video_frame,不再报类型错points=pc.calculate(depth_frame)# 保存 PLYpoints.export_to_ply("output.ply",color_vframe)exceptExceptionase:print(e)finally:pipeline.stop()
http://www.jsqmd.com/news/1241740/

相关文章:

  • 如何在PS4上轻松管理1490+游戏金手指:GoldHEN金手指管理器完全指南
  • 翡翠资产配置的技术评估框架:从材质鉴定到流通潜力的五维模型
  • AI论文降重工具:深度学习驱动的学术写作优化方案
  • 奇瑞小蚂蚁动力电池系统故障诊断与维修指南
  • 统计学理论与实践鸿沟:从教材概念到业务问题解决的路径重构
  • AI入门指南:李宏毅吴恩达李飞飞李沐四门课程学习路线
  • 济南宝珀中国官方售后服务门店|官网认证地址及电话全新启用(2026年7月最新) - 宝珀售后服务中心官网
  • 查询优化案例复盘:从线上故障到长效保障‌
  • VS2010 C++项目JSON处理实战:JsonCpp选型、集成与避坑指南
  • 关于图论【卡码网99.计数孤岛的思考】
  • 069、TensorFlow Lite Micro的Testing项目:测试与验证
  • 跨模型工具调用兼容层设计与实现
  • GitHub Pages与Jekyll搭建技术博客全攻略
  • OpenCV StereoBM双目立体匹配参数详解与调优指南
  • 大模型搜索中知识图谱与实体关系对企业可见度的影响
  • 2026合肥各区黄金回收行情|官方合规资质门店推荐,透明计价高效规范变现 - 商业每日快报
  • 深入解析TI微控制器CRC控制器:硬件加速数据完整性校验实战指南
  • 092、3A联动与协同控制:曝光、对焦与白平衡的实时博弈
  • 悉尼墨尔本求职,策略能一样吗?|蒸汽求职分享
  • TVA智能视觉检测系统在工业4.0中的核心价值与应用
  • LSTM如何解决梯度消失:门控机制与梯度流动原理详解
  • FreeCAD参数化建模核心思维:从操作到设计的跨越
  • 2026汉中高空蜘蛛人工程排名 TOP5 持证高空作业,提供外墙翻新、防水补漏、管道安装一站式服务 联系方式推荐 - 中检检测集团
  • C++并发编程实战:开源翻译项目与核心学习路径解析
  • 哈尔滨生鲜水果供货怎么做?别只看单价,先看品类完整性、损耗保障和配送稳定性 - 中国远见品牌企业资讯
  • 泉州不住家阿姨哪家实力强
  • Claude Code Skills开发指南:模块化智能体能力扩展
  • 嵌入式开发实战:TM4C1292外设识别与GPIO配置详解
  • 091、AWB自动白平衡:统计法与AI色温估计的协同优化
  • 技术债务清理:识别依赖管理、协作流程与认知滞后三大隐形负债