I am new on stereo vision. I am trying to calculate real distance from stereo's disparity map and depth map. But I don't understand how can I do that. I have two output, one of them detect cars and giving x,y,w,h coordinates. The second one is that the stereo output with applied colormap.
What I am trying to find car's distance from disparity map or depth map like this picture,

I have an array of depth_map which is 480x640,

How can I find car's distance like above picture from depth map? Is there any formula for that or sample example? Thank you.
How someone has already said in the comments, you need the parameters of both cameras. In other words, the calibration information of your system:
After that, yes, there is a formula. Please refer to my other answer here.
If you want an example to go from disparity map to 3D points, you can go here and follow the trail in the code.