# Estimate image depth values with `sample_depth_estimation`
The `sample_depth_estimation` sample application estimates per-pixel depth maps from RGB images using ROS 2 nodes. It uses the Qualcomm® AI Engine Direct SDK (QNN) for on-device model inference.
`sample_depth_estimation` accepts an RGB image named `input_image.jpg` as input or subscribes to the `/cam0_stream1` topic from the `qrb_ros_camera` node. It publishes the depth estimation results as a per-pixel depth map to the `/depth_map` topic.
Note
- For more information, see the [sample_depth_estimation](https://github.com/qualcomm-qrb-ros/qrb_ros_samples/tree/jazzy-rel/ai_vision/sample_depth_estimation) GitHub repository.
- The model is sourced from the [Depth Anything V2](https://aihub.qualcomm.com/iot/models/depth_anything_v2?searchTerm=depth&domain=Computer+Vision) model, in which depth refers to the distance from the camera to each point in the image, estimated using a deep convolutional neural network.

## Pipeline flow for `sample_depth_estimation`
## ROS nodes used in the `sample_depth_estimation` pipeline
| ROS Node | Description |
| --- | --- |
| `sample_depth_estimation` | A Python-based ROS 2 Jazzy package that processes per-pixel depth values. This ROS node subscribes to an image topic, and publishes depth estimation result topic after preprocessing and postprocessing. |
| `qrb_ros_camera` | Qualcomm ROS 2 package that captures images with parameters and publishes them to ROS topics. |
| `qrb_ros_nn_inference` | This ROS node loads a trained AI model, receives preprocessed images, performs inference, and publishes results. |
| `image_publisher` | A ROS 2 Jazzy package that publishes the image ROS topic with the local path. For more information, see [image_publisher](https://github.com/ros-perception/image_pipeline). |
## ROS topics used in the `sample_depth_estimation` pipeline
| ROS Topic | Type | Description |
| --- | --- | --- |
| `/image_raw` | `sensor_msgs.msg.Image` | Public image information. |
| `/qrb_inference_input_tensor` | `qrb_ros_tensor_list_msgs.msg.TensorList` | Preprocess message. |
| `/qrb_inference_output_tensor` | `qrb_ros_tensor_list_msgs.msg.TensorList` | Postprocess message. |
| `/depth_map` | `sensor_msgs.msg.Image` | Contains per-pixel depth values as a color map. |
## Prerequisites
You have completed the following settings in [Set up the environment for running sample applications](https://docs.qualcomm.com/doc/80-70030-265/topic/quick_start.html#setup-demo-qs).
- Set up the device
- Set up the host docker
## Run out-of-the-box `sample_depth_estimation`
1. On the development kit, run the following commands:
>
>
> # setup runtime environment
> (ssh) source /usr/share/qirp-setup.sh -m
> (ssh) export ROS_DOMAIN_ID=55
>
> # Launch the sample depth estimation with image publisher, You can replace 'image_path' with the path to your desired image.
> (ssh) ros2 launch sample_depth_estimation launch_with_image_publisher.py image_path:=/usr/share/sample_depth_estimation/resource/input_image.jpg
> # Launch the sample depth estimation node with qrb_ros_camera ros node.
> (ssh) ros2 launch sample_depth_estimation launch_with_qrb_ros_camera.py
> Copy to clipboard
2. In a terminal of the host computer, run the following commands:
1. Start a terminal and run the following command to check the depth estimation result.
(ssh) export ROS_DOMAIN_ID=55
(ssh) ros2 topic echo /sample_container/depth_map
Copy to clipboard
2. Start the `rqt` to view the depth estimation result on the host docker, for more information, see [rqt](https://wiki.ros.org/rqt).
# YOUR_HOST_IP is the IP address of the Host where you want to view the sample output.
(ssh) export DISPLAY=YOUR_HOST_IP:0
(ssh) export ROS_DOMAIN_ID=55
(ssh) rqt
Copy to clipboard
3. Select the following buttons in sequence.
Plugins --> Visualization --> Image View
4. Select topic `/sample_container/depth_map` by manual on rqt gui, then picture show on `rqt` successfully.
## Build and run `sample_depth_estimation`
1. In a terminal of the host computer, run the following commands:
1. Build the sample application project.
(ssh) cd /target/qcs9075-iq-9075-evk/qirpsdk_artifacts/qcs9075-iq-9075-evk
(ssh) tar -zxf qirp-sdk_.tar.gz
(ssh) cd /qirp-sdk
(ssh) source setup.sh
# build sample
(ssh) cd /qirp-samples/ai_vision/sample_depth_estimation
(ssh) colcon build
Copy to clipboard
2. Package and push the sample application to the device.
# package and push build result of sample
(ssh) cd ./install/sample_depth_estimation
(ssh) tar -czvf sample_depth_estimation.tar.gz lib share
(ssh) scp sample_depth_estimation.tar.gz root@[ip-addr]:/opt/
Copy to clipboard
2. On the development kit, run the following commands:
1. Install the sample application.
# Remount the /usr directory with read-write permissions
(ssh) mount -o remount rw /usr
# Install sample package
(ssh) tar --no-overwrite-dir --no-same-owner -zxf /opt/sample_depth_estimation.tar.gz -C /usr/
Copy to clipboard
2. Run the sample application with the steps in [Run out-of-the-box sample\_depth\_estimation](https://docs.qualcomm.com/doc/80-70030-265/topic/sample_depth_estimation.html#run-depth-estimation).
Last Published: Jul 23, 2026
[Previous Topic
Classify images with sample\_resnet101](https://docs.qualcomm.com/bundle/publicresource/80-70030-265/topics/image_classification.md) [Next Topic
Detect faces with sample\_face\_detection](https://docs.qualcomm.com/bundle/publicresource/80-70030-265/topics/sample_face_detection.md)