Calculate distance to a hill from photography

image processingtrigonometry

I'm wondering if it's possible to determine the distance to the base of a hill from a photograph.

Using the camera specs including focal length and sensor size, I'm ok with working out the size of objects roughly in the plane of the camera aperture. However, it looks like a sloping plane that is oblique to the plane of the camera changes things.

In the figure below, I know the height of the hill, the slope of the hill, and the height at which the picture was taken. I can get phi, the field of view of the camera.

The camera is not held level to the ground; the vertical midpoint of the photo is not at the height of the camera.

The red lines show the extent of the image, and the aqua lines show the projection of the hill on the image.

Schematic of the problem

The photo looks something like:
enter image description here

It feels like this is an unconstrained problem; I can't quite figure it out. Any pointers would be really helpful!

Best Answer

The problem is well constrained.

From the two green lines on the photo, as well as the camera's field of view, you can determine the visual angle $\alpha_0$ of the slope as seen from the camera.

Given a distance $D$ from the slope, you can determine the visual angle $\alpha(D)$ of the slope as seen from a camera at distance $D$ from the slope, since you know the position of that camera and both ends of the slope. Note that $\alpha(D)$ is strictly monotonous in $D$. Your aim is now to find $D_0$ such that $\alpha(D_0) = \alpha_0$. This can be numerically solved using half-interval search or Newton's method (Newton's method will converge if $D_0 > 0$ and your initial value for $D$ is $0$).

Related Question