If you're using one camera, you use OpenCV to calibrate the camera, and the rest is straight geometry.
THIS tutorial is how to calibrate the camera.
THIS function gets you field of view in degrees.
You have an angle, and a known distance. All else is triangles.