I did a lot of searching but still haven't found a way to calculate the height of objects based on pictures taken with my camera.

Here are my variables:

The distance between the object and my camera: 116 cm.
The object's real height: 17 cm.
The height of the object in my photo: 574 px.

How exactly can I find out the height of different objects at that exact distance?

  • 2
    $\begingroup$ We definitely would need more information. I don't know what exactly, but how even something like resolution of the picture could change to produce different results. (574 px in a 640x480 image is very different from 574 px in a larger image) $\endgroup$ – jwc845 Sep 28 '18 at 15:38
  • $\begingroup$ Is the zoom also constant? $\endgroup$ – Mohammad Zuhair Khan Sep 28 '18 at 15:39
  • $\begingroup$ The size of the image is always constant: 5312 x 2988 px $\endgroup$ – Sorin Haidau Sep 28 '18 at 15:46
  • $\begingroup$ There is no zoom. $\endgroup$ – Sorin Haidau Sep 28 '18 at 15:47
  • 3
    $\begingroup$ Isn't it just a proportion? The distance of the object shouldn't even count, if it remains constant. $x/574 = y/17$, where $x$ is the pixel height of the object and $y$ is the real height of the object in cm $\endgroup$ – Exodd Sep 28 '18 at 15:55

Pretending that the lens is a thin lens, you have a pair of similar triangles through the center point of the lens. One is a right triangle with legs $17$ and $116$ cm. The other has a leg corresponding to $17$ cm is your $574$ px. To finish the calculation you need the distance from the lens to the sensor in pixels. That is probably hard to find.

Another approach is to use the size of the picture in pixels and the angle of view of your lens. If you know the angle of view you can compute the height of the picture in cm at the distance of $116$ cm and compare that to the total number of pixels in the frame.

Another approach is to take a picture of a ruler at a distance of $116$ cm and see how many pixels it represents.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.