I have had issues finding any information on how to use a depth map/image to gain the distance to an obstacle.
TLDR: I have a depth map as an OpenCV Mat, I know it's CV_16UC1, but I dont know how to get the distances from it.
I have an Intel Realsense D415 camera, I have installed the SDK, the ROS wrapper, I have a topic with a depth map published. (/camera/depth/image_rect_raw)
Next, I've written a little program in C++ that converts the image using cv_bridge to an OpenCV image and I display it in a window, so I know it's working. (image: https://i.imgur.com/QyKWp2J.png )
Now I need to get the distance from it, which I have no idea how to do and have been unsuccessful in finding help for. I imagine I'm only going to want to use the top half or 2/3 of the image, because of the way the camera will be mounted, so the bottom third/half will only contain of floor/ground.
I feel like I am missing something big and simple in order to make this work, but I literally dont even know what to do now.