# Calculation of Distance of an object given the field of view of camera [duplicate]

I am using an Olympus M. Zuiko 45mm f/1.8 Camera, I have to calculate the distance at which the lens should be present so that it captures the complete object at once.

I know that the field of view of the camera is 27 degrees, and the aspect ratio is 4:3. Assuming that they are talking about the diagonal field of view.

I want to ensure that the camera at least captures the complete width of the object, so suppose if the camera is capturing a width w, it will be capturing the length 4w/3, therefore the diagonal would come out to be 5w/3.

now, I use simple trigonometry to calculate the desired distance

tan(field_of_view/2) = (diagonal_length/2) / (desired_distance)

so, desired_distance = diagonal_length / (2 * tan(field_of_view / 2))

Although the math looks correct to me, somehow the results do no match the actual phenomenon, can someone please go through this and suggest corrections?

• Maybe show an example photo? But the first thing that springs to mind is that the sensor size also affects FOV. – user31502 Dec 20 '18 at 15:12
• There’s a “computer vision” tag over at stack overflow. This se is more concerned with producing images in the artistic sense but does have some more technical members. That being said, you simply may just have more luck over there. – Hueco Dec 20 '18 at 15:49
• Do you need precise numbers or are you just trying to ballpark how far away you need to stand? – Please Read Profile Dec 20 '18 at 17:57

Your math is unnecessarily complex, no need to compute or use angles (and therefore, no need for any trigonometry).

Using the lens magnification formula M = ƒ/(do - ƒ), where do is the distance from the lens to the object being photographed (and assuming do ≫ ƒ), then your desired lens-to-object distance is:

do = ƒ(1 + 1/M)

But the magnification M is just the ratio of the object's real size to its size on your sensor. Assuming your sensor is a Micro Four-Thirds sensor (based on the lens you're using), with imaging area dimensions sw × sh of 17.3 mm × 13 mm, then the distance formula for your application is just:

do = ƒ(1 + w / sw) = 45 mm * (1 + w / 17.3 mm)

Make sure you use millimeters for your object's width w.

Note: Again, this assumes your magnification is small (M ≪ 1). This is the same thing as saying that your object being photographed is much larger than the width of your sensor. This also means you are not photographing in the macro regime. When magnification is at least, say, 0.1 (just picking a non-insignificant fraction of 1), then the actual precise location of your lens's principal planes (where focal length is measured from) starts to matter. But assuming small magnification, you can just measure your object distance from a reasonable position such as the front of the lens barrel, and call it good enough.

You can use Excel to calculate the angle of view and distances enscoped by this field of view. The following is for a 50mm lens mounted on a full frame 24mm height by 36mm length.

For 50mm lens mounted on full frame format 24mm height by 36mm length 46.8mm diagonal. Subject distance 0.5 meters.