Rigid overhead camera observing a gauge block and reference bar on a flat workplane.

What you need

Use a measured target at the exact working height, fixed camera settings and a rigid camera mount.

Estimated length of a 235-pixel span. 0.100 mm/pixel: 23.5 mm; 0.102 mm/pixel: 23.97 mm.
Estimated length of a 235-pixel span. Original Academy diagram using illustrative values; not a measured hardware result.
Read the diagram as a data table
Values used in the illustration
Condition or componentmm
0.100 mm/pixel23.5
0.102 mm/pixel23.97

The calculation

s = L_reference / p_reference
L_object = s × p_object

Lengths L are mm and p are pixels. The single scale applies only under the geometry and height used to measure it.

Worked example

Illustrative numbers. Replace them with your measured inputs.

A 50 mm reference spanning 500 pixels gives 0.1 mm/pixel. A part spanning 235 pixels is then estimated at 23.5 mm. If the scale changes to 0.102 mm/pixel, the estimate becomes 23.97 mm.

Try it step by step

  1. Place the reference beside the part at the same height and measure several spans instead of relying on a single short segment.
  2. Estimate scale at the center and near the corners to expose perspective or distortion variation.
  3. Keep focus, resolution and mounting unchanged, then compare object measurements with an independent physical measurement.
  4. Use distortion correction and a planar transformation when a single scale cannot meet the required accuracy across the workspace.

How to check the result

Record residual error at multiple known distances and positions. The result should show where the simple model is and is not valid.

Common mistake to avoid

A raised part changes apparent scale in a perspective camera. A ruler lying on the table does not automatically calibrate the top of every object.

Reference reading

Primary references for the underlying models, APIs or application context. The worked numbers and plots above are educational calculations, not results reported by these sources.

Read our methods, limitations and safety notes.