Calculating distance of a detected object using depth map


I am new to the Zed Cam World, and also to the stereovision, so this might sound like a noob question.

I am using the Zed2i object detection to detect the people with their relative distance in a scene. I am retrieving the distance value of the objects from the “position values” from the object detection module. However, the position_values I am getting from the object detection module are not accurate, it could be possible that this position is calculated based on the bounding boxes. Therefore, I am trying to use the depth map to detect the distance to the detected person. but I am not sure how can I do that with Zed camera. also is there a way to visualize the detected person with distance values in RVIZ. I have Zed2i and using Nvidia Jetson, SDK 3.6.2, ROS 1.0.

Any help or even the links to the Zed help topics will be highly appreciated.
Thanks and best regards.

Hi @hqu,
you can retrieve depth information by accessing the values of the depth map or the values of the point cloud. All the data are registered, so the pixel (u,v) of the left RGB image, has the depth value available in the pixel (u,v) of the depth map and the 3D coordinates available in the (u,v) value of the point cloud.
Here you can find useful examples:

Regarding Rviz, we released a plugin to visualize all the object detect information provided by the ZED ROS wrapper: