Calculate the distance of an object in a picture?

I’d like to know the distance between the camera and the object, just by looking at the object height (pixels) or it’s width and the real life dimensions. Here is a formula we can get on the internet:

Formula

But there is something very wrong with it. The “Sensor height” parameter is wrong and cannot be inversely proportional to distance. It is giving obvious absurd answers.

Let’s take a very simple example. If a person is roughly 100 meters away from the camera, with a camera with a “sensor height” of 100 mm from the ground, its size on the image will be of 50 pixels height. If I am 200 mm from the ground I should not get a result of twice less distance… like 50 meters away from the camera… try it, it’s wrong !

Please help me out here, this do not make sense…

If you have two recursive calls in a function and one terminates before the second how do you calculate the time complexity?

Suppose you have a function which calls to itself twice. So both go down recusively until they reach some condition. But one of them will go less times than the other. For example one would call itself n times until it terminates while the second calls itself merely n-5 times.

How do I go by, calculating the lower bound. I assume, for the upper bound you just go about calculating the bigger path of n levels. But how would you calculate the lower bound?

How to calculate this n dimensional integral?

The integral such as enter image description here

It’s easy to evaluate the first few items

Integrate[x1 (1/(-1+n))^n (1/v1)^(n/(-1+n)) x1^((2-n)/(-1+n)), {x1, 0, v1}] Integrate[x1 Integrate[(1/(-1+n))^n (1/v1)^(n/(-1+n)) x1^((2-n)/(-1+n)) x2^((2-n)/(-1+n)), {x2, 0, x1}], {x1, 0, v1}] Integrate[x1 Integrate[Integrate[(1/(-1+n))^n (1/v1)^(n/(-1+n)) x1^((2-n)/(-1+n)) x2^((2-n)/(-1+n)) x3^((2-n)/(-1+n)), {x3, 0, x1}], {x2, 0, x1}], {x1, 0, v1}] 

but how do I calculate this integral where the number of integrals is aribtrary?