How can I estimate an object's distance from its known size and a camera's field of view?

Asked 1/19/2024

4 views

2 answers

0

I know the real-world size of an object in an image and want to estimate how far it is from the camera. I don't have the camera's focal length or sensor size, but I do know the image is 1080p and the camera is reported to have about a 75° diagonal field of view (for example, a Microsoft LifeCam Studio). Can distance be estimated from the object's pixel size and the camera's angle of view alone? If so, what formula should I use, and what are the limitations?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

2y ago

2 Answers

1

  • A 1080p image (assumed to be 1980x1080p) has a 2200px diagonal
  • If the diagonal field of view is 75° then a pixel is 75/2200=0.034° (or 0.000594 radians).
  • So the angle of view of anything is measured_size_in_pixels × 0.034° or measured_size_in_pixels × 0.000594 rd
  • And given the relation size/distance = tan(angle_of_view)(*), the distance is size ÷ tan(angle_of_view)
  • For small angles, the tangent of an angle is very close to the measure of the angle in radians, so you can simplify to size ÷ angle_of_view.

If you put all that together:

distance = physical_size × 1683 ÷ size_in_pixels

when the size in pixels is under 200 pixels.

Of course all this is rather approximate and only works for objects that are nearly perpendicular to the camera axis (usually vertical measures are OK if the camera is held horizontally).

(*) actual is size/distance = 2 × tan(angle_of_view ÷ 2) but for small angles that won't make much difference.

Originally by user75947. Source · Licensed CC BY-SA 4.0

user75947

2y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes—approximately. If you know the camera’s field of view and how many pixels the object spans, you can estimate the object’s angular size, then convert that to distance.

For a 1080p frame, the diagonal is about 2200 pixels. With a 75° diagonal field of view, each diagonal pixel corresponds to about:

75° / 2200 ≈ 0.034° per pixel ≈ 0.000594 radians per pixel.

So if the object measures N pixels along that same direction, its angular size is approximately:

angle ≈ N × 0.000594 radians

Then use:

distance = physical size / tan(angle)

For small angles, tan(angle) ≈ angle, so:

distance ≈ physical size / angle ≈ physical size × 1683 / N

This is only an approximation. It works best when:

  • the stated field of view is accurate,
  • you measure along the same axis the FoV refers to,
  • the object is roughly perpendicular to the camera axis,
  • the object is not too large in the frame.

If you don’t know focal length or sensor size, using field of view is the practical alternative. Otherwise, a known-size reference object in the same image can also be used for scaling.

UniqueBot

AI

2y ago

Your Answer