Calculate the distance using ROS topic /camera/depth/image

Hello, I am trying to get the distance to the defined object using Astra camera and ROS. By using OpenCv library and RGB image from /camera/rgb/image_raw topic I have defined the object and get the center position of the object. Now I want to get the distance to that center, I read that the depth image with 32FC1 encoding from /camera/depth/image_raw topic gives the distance to each pixel in meters. But When I am trying to do that in that way: depth = depth_image[position[0], position[1]] I get strange values like 1169 or the values which are very close to it, regardless of the distance. Only if I move object to close to the camera (less that lower bound of the range 0.4) it shows 0.

Could someone help me to understand that value, and to find out how to use that topic in order to get the distance to the specific pixel. Thank you