sample_depth_estimation 示例应用接受名为 input_image.jpg 的 RGB 图像或来自 qrb_ros_camera 的 /cam0_stream1 ROS 话题。它使用 Qualcomm AI Engine Direct SDK (QNN) 运行模型推理,并将结果作为包含每像素深度值的 /depth_map ROS 话题发布。
该模型源自 Depth Anything V2,这是一种用于深度估计的深度卷积神经网络模型。
下图展示了一个深度估计结果示例。

sample_depth_estimation 管道流程
下图展示了 sample_depth_estimation 的管道流程。
sample_depth_estimation 管道。
sample_depth_estimation 中使用的 ROS 节点
下表列出了 sample_depth_estimation 中使用的 ROS 节点。
sample_depth_estimation 中使用的 ROS 话题
下表列出了 sample_depth_estimation 中使用的 ROS 话题。
前提条件
你已根据安装 QIR SDK完成设备设置,并在设备上安装了 ROS2 Jazzy 和 Qualcomm Intelligent Robotics (QIR) SDK。从源码构建 sample_depth_estimation
当你需要修改示例代码时,可以从源码构建 sample_depth_estimation。设备端步骤包括安装依赖、克隆源码仓库和构建包。
设备步骤
1
下载 Depth-Anything-V2 模型
Download the model
2
安装依赖
Install the dependencies
3
从 qrb_ros_samples 仓库下载源码
Download the source code
4
从源码构建示例应用
Build the sample application
5
使用 source 命令设置环境并启动示例应用
Launch the sample application
6
你可以用自定义图像文件或模型路径替换
Launch with a custom image and model
7
如果连接了 GMSL 摄像头,你也可以使用 qrb_ros_camera 启动
Launch with qrb_ros_camera
8
使用该启动脚本时,它使用默认参数,即以 10 Hz 的发布频率发送本地 input_image.jpg 文件
9
然后你可以在 rqt 中通过话题名 /depth_map 查看 ROS 话题
要安装
rqt,请参阅 ROS 2 Jazzy documentation。a. 运行 rqt 并依次选择以下按钮:Plugins --> Visualization --> Image View。b. 选择 /sample_container/depth_map 查看结果。
