Calculate distance to person from camera if camera is on the floor

1.8k Views Asked by At

Below is a diagram of the setup. Using a smartphone camera, placed on the floor, I'd like to know how to figure out person's height, Y.

Since I know how far off the floor the camera is and the angle the camera is at, I know i & j.

I can't figure out what trig I need to figure out the triangle that is either the distance from the camera to the person's feet or the triangle formed by the person on the camera sensor.

Without using any reference points in the image (e.g. credit card), is it possible to figure out the person's height?

enter image description here

2

There are 2 best solutions below

3
On

It should be relatively clear that without any reference objects, it is not possible to determine how tall the person is or how far away from the camera he or she is standing [1]. However, we can find a relationship between those two values [2]. I hope the proof below will address both of these points.

[1] Imagine that besides the person, all other parts of the image you take are blurred - specifically, there are no reference objects which you know the height of. Say we have an image of a person who is actually $l$ cm tall, appears to be $h$ cm tall, and is standing a distance $d$ cm from the camera lens. Since we have no reference objects, we should get multiple values of $l$ and $d$ that make for a similar image height $h.$ As we increase both $l$ and $d,$ our person's image height $h$ can remain constant.

[2] Though we may not be able to find either $l$ or $d$ given $h$ and specifics on the camera position, there is obviously a relationship between the values. Denote the phone image height $m,$ and the phone's vertical view field angle $x$ (these should be specification constants you can find). Notice that when the phone is tilted up, this angle $x$ is sweeping a larger and larger view field. We can quantify this with the value of the phone tilt, which we call $y.$ We see that $y = \arctan(\frac{i}{j})$ by trigonometry.

Again using trigonometry, we find the vertical view field to have length $d(\tan(y + \frac{x}{2}) - \tan(y - \frac{x}{2})).$ Now using a basic proportion, we see that $\frac{h}{m} = \frac{l}{d(\tan(y + \frac{x}{2}) - \tan(y - \frac{x}{2}))}.$ Rearranging, we have that $\boxed{\frac{d}{l} = \frac{m}{h(\tan(y + \frac{x}{2}) - \tan(y - \frac{x}{2}))}}.$ Notice from earlier that $y = \arctan(\frac{i}{j}).$ All other values on the right side of the equation above can be found via tech specs or measurements. If you know either $l$ or $d,$ you can find the other value with the equation.

2
On

Your question at first seems impossible to answer with the information given, but after a closer look, I suspect you have left a clue or two in your statement that allows your answer to be estimated to a reasonable degree. I will have to make an assumption or two to get that estimate, so here we go: 1. Let the angle between the wall and the camera be phi such that tan (phi) = i/j. That will also be the angle of the midpoint of the field of view of the camera relative to the floor, from basic trig. 2. Now I assume you want to photograph the whole person as centered in the photograph, producing equal borders above and below him/her, neglecting any edge effects caused by the camera not pointing horizontally. Thus we have the midpoint of the field of view pointing at the midpoint of the person. 3. Next you measure the floor distance from the persons feet to the camera edge on the floor, and call it G. The last 4 lines of your description of the problem suggests you are looking for a triangle, and once you have it, and it doesn't involve a comparison object, you are at liberty to measure G and complete your triangle.
4. With this approach, the answer to your question is:

Yes, you can determine the height of the person from the data given. The answer is:

Y  = 2(i+G)tan(phi)+ 2j  .

William