Skip to main content
sample_depth_estimation 示例应用使用 ROS 2 节点从 RGB 图像估计每像素深度图。它使用 Qualcomm® AI Engine Direct SDK (QNN) 进行设备端模型推理。 sample_depth_estimation 接受一张名为 input_image.jpg 的 RGB 图像作为输入,或订阅来自 qrb_ros_camera 节点的 /sample_container/cam0_stream1 topic。它将深度估计结果作为每像素深度图发布到 /sample_container/depth_map topic。
注意
  • 有关更多信息,请参见 sample_depth_estimation GitHub 仓库。
  • 此模型来自 Depth Anything V2,其中深度指的是从摄像头到图像中每个点的距离,使用深度卷积神经网络估计。

图:sample_depth_estimat 的示例效果

sample_depth_estimation 的流水线流程

图:sample_depth_estimation 的流水线流程

sample_depth_estimation 流水线中使用的 ROS 节点

sample_depth_estimation 流水线中使用的 ROS topic

ROS topic类型说明
/image_rawsensor_msgs.msg.Image发布的图像信息,来自 image_publisher。以绝对名称订阅,因此不带命名空间。
/sample_container/cam0_stream1sensor_msgs.msg.Image摄像头图像流,来自 qrb_ros_camera。
/sample_container/qrb_inference_input_tensorqrb_ros_tensor_list_msgs.msg.TensorList预处理消息。
/sample_container/qrb_inference_output_tensorqrb_ros_tensor_list_msgs.msg.TensorList后处理消息。
/sample_container/depth_mapsensor_msgs.msg.Image包含以颜色图表示的每像素深度值。
注意launch 文件将所有节点放置于 sample_container 命名空间下,因此该示例的 topic 都以 /sample_container/ 为前缀。只有 /image_raw 以绝对名称订阅,因此保持全局。

前提条件

你已完成 设置运行示例应用的环境 中的以下设置。
  • 设置设备
  • 设置主机 docker

开箱即用运行 sample_depth_estimation

1

在开发套件上运行示例

SSH Session
2

在主机计算机上查看深度估计结果

  1. 启动一个终端并运行以下命令来检查深度估计结果。
    SSH Session
  2. 启动 rqt 以在主机 docker 上查看深度估计结果,有关更多信息,请参见 rqt。
    SSH Session
  3. 依次选择以下按钮。Plugins —> Visualization —> Image View
  4. 在 rqt gui 上手动选择 topic /sample_container/depth_map,然后图片将成功显示在 rqt 上。

构建并运行 sample_depth_estimation

以下步骤以 Dragonwing IQ-9075 Evaluation Kit 为例构建 sample_depth_estimation 包。
1

在主机计算机上构建并打包

  1. 构建示例应用项目。
    SSH Session
  2. 打包并将示例应用推送到设备。
    SSH Session
2

在开发套件上安装并运行

  1. 安装示例应用。
    SSH Session
  2. 按照 开箱即用运行 sample_depth_estimation 中的步骤运行示例应用。