An object 1 meter (1000mm) in height is photographed with a 50mm focal length lens.
The object distance is 5meter (5000mm).
H = actual height = 1000
D = actual distance = 5000
We can trace out a triangle with the vertex at the lens. The base of this triangle is the objects height; the height of this triangle is object distance.
The ratio of height to distance is 1000 ÷ 5000 = 0.200.
Inside the camera, we can trace a similar triangle. A similar triangle means the angles of both triangles have identical angles and the ratio of corresponding sides will be identical.
The height of this image triangle is the focal length of the lens
d = 50
The base of this triangle is unknown. We can calculate; 50 X 0.2 = 10
Thus h = 10mm
D = f(H/h)
h = 10
D = 50 X (1000/10)
D =50 X 100
D = 5000 (actual object distance = 5 meters)