# Measure in photo formula help

Good Day

I am trying to measure the width of an object in a photo as accurate as possible using the formula found in a previous question.

Distance to object(mm)=f(mm) x real height(mm)x image height(pixels)/object height(pixels)x sensor height(mm)

I change the real height to real width and the sensor height to sensor width.

The problem I am having is that when the object distance is small the object measure more than what it measures in real life and when the distance is larger the object measure much less than what it measure in real life. Is there anything I can add to the formula to help resolve this. I need very accurate measurements.

Here is examples of what I did.

I know the object is 1047.75 mm wide in real life...

The lens I use is a Canon L-Series 70-200 mm

Example 1:

When I take a picture of the object I get the following

Distance to object = 5374 mm (I take the distance from the beginning of the lens to the object)

Focal length = 80 mm (Get it from exif data)

Image width = 5472 pixels

Sensor size (width) = 35.9 mm (Specifications from camera)

Object width in photo = 2554 pixels

Calculation:

Real width = 5374 mm x 2554 pixels x 35.9 mm / 80 x 5472 pixels

Real width = 1125.58 mm (I need to get as close as possible to the real width)

The object measures 77.83 mm more than what it measure in real life

Example 2 (distance increase)

Distance to object = 13 509.10 mm (I take distance from beginning of the lens to the object)

Focal length = 200 mm (Get it from exif data)

Image width = 5472 pixels

Sensor size (width) = 35.9 mm (Specifications from camera)

Object width in photo = 2329 pixels

Calculation:

Real width = 13 509.10 mm x 2329 pixels x 35.9 mm /200 x 5472 pixels

Real width = 1032.08 mm (I need to get as close as possible to the real width)

The object now measures 15.67 mm less than what it measure in real life.

Is there any add on to the formula to solve this? What else can I try to get closer to the real width? I know the difference is very small, but I need the difference not to be more than 3.5 mm.

I will highly appreciate help to solve this.

Thank you

• Why a 70-200 and variable distance to camera? Can you add in what you're doing and why to the question? – OnBreak. Aug 31 '18 at 14:46
• We've answered this same question many times in the past. Have you searched the existing database of questions/answers for a solution? – Michael C Aug 31 '18 at 17:37

Your error is, you are using the focal length 80mm when in fact, and this value is about 85mm thru 86mm.

When we close focus, we must extend the lens forward from the sensor to achieve focus. This is because the focal length is a value, distance lens to sensor when imaging a distant object (at infinity ∞). Since the lens has limited ability to refract light (bend inward), the image forming cone of light becomes elongated.

There are many lens formulas. I will use (LM) ÷ (1 + M) to find the revised focal length now called back-focus.

M = image size ÷ object size = (magnification) Find image size Chip measures 35.9mm This span contains 5472 pixels Each pixel measures 35.9 ÷ 5472 = 0.0066mm Image spans 2554 pixels Image measures 2554 X 0.0066 = 16.8564mm Object measures 1047.74mm M = 16.8564 ÷ 1047.74 = 0.0161(a reduction) L = lens to object distance = 5374

Solve for back-focus distance (5374 X 0.0161) ÷ (1 + 0.0161) = 86.5214 ÷ 1.0161 = 85.15

The cone of the image forming rays trace out a triangle. Base = 16.75mm ---- height = 85.15mm Ratio = 16.75 ÷ 85.15= 0.1967 (the image triangle image length to back-focus ratio).

On the object side of the lens exists the same ratio of distance to object dimension = 0.1967

Thus distance to camera lens is L = 5374mm The dimension of the object is 5374 X 0.1967 = 1057.1mm This is close but no cigar accuracy is about 1%.

I did all this to prove you need to find the back-focus distance.

You can solve (Lf) ÷ (p – f)

L = subject distance = 1047.74 f = focal length try 80 (1047.74 X 80) ÷ (1047.74 – 80) = 83819.2 ÷ 967.74 = 86.61mm Back focus distance

Both methods are approximations: The lens to object distance is actually a point called the frond nodal. The image to lens distance is from a point called the rear nodal. We don’t know where in the lens barrel these points fall. To find we need an optical bench. Best we can do; will be about right.

• Dear Alan, thank you so much for your response and willingness to assist. I truly appreciate it. Thank you. – Radiog Sep 1 '18 at 6:55

I take the distance from the beginning of the lens to the object

Distance should always be measured from the camera's imaging plane (the sensor or film), not the front of the lens. Most cameras have a mark indicating the exact location of the sensor plane. With a lens such as a 70-200mm f/2.8, your distance measurement is in error by about 250mm when you measure from the front of the lens instead of from the camera's focal plane.

For more, please see What is the reference plane used when the minimum focus distance is measured?