Lenses & opticsHow-to

Magnification at different working distances: match one world region

Compute the magnification of every frame in a series shot at different working distances, then scale each region so all show the same world area.

LumaSpec Vision9 min read Share on LinkedIn

On this page 8 sections
  1. 01Magnification from focal length and distance
  2. 02Worked example: one region at the near and far station
  3. 03Set the scale for every frame in six steps
  4. 04Verify the scale with one ruler shot
  5. 05Choosing the glass and the mount
  6. 06Where one number per frame stops holding
  7. 07Decision, then the bench
  8. 08Questions

A camera that moves between stations changes the image scale of every frame it takes. When a series of images must each contain the same world region — a feature tracked along a conveyor, close and far shots mosaicked into one map, or one template reused at several distances — you need the magnification of each frame, not one number for the set. For a fixed-focal-length lens that scale follows from the focal length and the distance to the part, and the ratio between two frames needs nothing more. This guide gives the formula, a worked example at two stations, six steps that place the same region in every frame, the ruler shot that proves it, and the cases where measuring beats computing.

Magnification from focal length and distance

The thin-lens equation fixes the magnification of a fixed-focal-length lens once you know the object distance u, measured from the part to the lens front principal plane:

m = f / (u - f) FOV = sensor_width / m px_per_mm_object = m / pixel_pitch scale station 1 to station 2 = (u1 - f) / (u2 - f)

f is the focal length in mm and u the object distance in mm. The first line gives magnification; the second gives the field of view width; the third converts to pixels per millimetre on the part. The last line answers the series question directly: multiply a region's pixel span in frame 1 by (u1 - f)/(u2 - f) to place the same world region in frame 2, with no sensor size needed.

Sensor width enters through the FOV line, so the same lens covers a different field on another format; the same lens on a different sensor guide works that side out.

How sensor width, working distance and field of view set the focal length Rays from the edges of the sensor pass through the lens and spread to the edges of the field of view. The ratio of sensor width to field of view is the magnification m.CameraField of view (FOV)Working distance (WD)≈ fsensor width slensm = s / FOVf = WD × m / (1 + m)
How sensor width, working distance and field of view set the focal length. Rays from the edges of the sensor pass through the lens and spread to the edges of the field of view. The ratio of sensor width to field of view is the magnification m.

Note how m falls: it varies with 1/(u - f), not 1/u. Halving the distance from the far station to the near one with a 50 mm lens raises m from 0.091 to 0.200, a factor of 2.2, not 2.

Worked example: one region at the near and far station

Example inputs for the arithmetic: a 50 mm lens on a camera with a 2464 x 2056 sensor of 3.45 um pixels. Sensor width is 2464 px x 0.00345 mm/px = 8.50 mm.

At station 1, u = 300 mm:

  • m1 = 50 mm / (300 - 50) mm = 0.200
  • FOV = 8.50 mm / 0.200 = 42.5 mm
  • px/mm = 0.200 / 0.00345 mm/px = 58.0 px/mm

At station 2, u = 600 mm:

  • m2 = 50 mm / (600 - 50) mm = 0.0909
  • FOV = 8.50 mm / 0.0909 = 93.5 mm
  • px/mm = 0.0909 / 0.00345 mm/px = 26.3 px/mm
Station u (mm) m FOV (mm) px/mm on part
1 300 0.200 42.5 58.0
2 600 0.0909 93.5 26.3

A region spanning 200 px at station 1 covers 200 px / 58.0 px/mm = 3.45 mm of the part. At station 2 that same 3.45 mm spans 3.45 mm x 26.3 px/mm = 91 px, or directly 200 px x (250/550) = 91 px. Resize the 200 px template to 91 px before matching frame 2 and both frames address the same world region. The FOV line is the same station-layout arithmetic as the working distance and field of view formula guide, applied per station.

Skip the shortcut m = f / u here: at station 1 it returns 0.167 instead of 0.200, about 17% low, and every ROI lands 17% off. The -f term is not optional at these distances.

Set the scale for every frame in six steps

  1. Read the focal length f from the lens barrel and the pixel pitch from the area scan camera data sheet; keep both in millimetres.
  2. Multiply horizontal pixels by pitch to get sensor width, once per camera.
  3. Log a distance u for every frame. On a stand, read the column scale at each station; on a motor axis, log the position at exposure.
  4. Compute m_i = f / (u_i - f) and px/mm_i = m_i / pixel pitch for each frame.
  5. Define the world region once in millimetres and multiply by px/mm_i to get that frame's pixel ROI.
  6. Where the region is defined in pixels of frame 1, scale directly with (u1 - f)/(u2 - f).

Store u, m and px/mm beside each image file. When a station later moves, one new row re-anchors the series.

Verify the scale with one ruler shot

Stand a ruler in the object plane at station 1 and count a 20.00 mm bar: 20.00 mm x 58.0 px/mm = 1160 px. The model predicts 1160 px x 0.455 = 527 px for the same bar at station 2. Count it there. A reading of 525 px is a 0.4% scale error, inside any practical ROI tolerance; a miss beyond about 2% means that frame's inputs were wrong, usually an unrecorded focus or position change.

The ruler also closes the loop in the other direction: the measured 1160 px implies m = 58.0 px/mm x 0.00345 mm/px = 0.200, and inverting the lens equation gives u = 50 mm x (1/0.200 + 1) = 300 mm. When no reliable distance exists, measure the scale per station instead — pixels per millimetre equals feature pixels divided by feature millimetres — which also absorbs the distortion and principal-plane effects below. That per-frame scale is the same quantity behind measuring object size from a camera image and the object-space pixel size calculation.

Choosing the glass and the mount

Large sweeps want one lens that focuses across the whole range. The LS-FFL-1676 spans a working distance range of 214-1536 mm at 60 mm focal length on large-format sensors.

Machine vision lenses60 mm fixed focal length lens, 65 MP, M58, WD 214-1536 mm (LS-FFL-1676)LS-FFL-1676
Type
Fixed focal length
Sensor format
Large format
Mount
M58
Resolution
Over 25 MP
$785.00View partBuild a system with it

Stations between 200 and 500 mm on a 2/3-inch camera pair well with a 35 mm lens: m runs from 35 / (500 - 35) = 0.075 up to 35 / (200 - 35) = 0.212, a field of 117 mm down to 42 mm on the 8.8 mm sensor width. The LS-FFL-0679 is a 35 mm, 6 MP C-mount lens for 2/3-inch sensors.

Machine vision lenses35 mm, 2/3", 6 MP, C-mount machine vision lens (LS-FFL-0679)LS-FFL-0679
Type
Machine vision fixed
Sensor format
2/3"
Mount
C-mount
Resolution
6-10 MP
$219.00View partBuild a system with it

If the region required at the farthest station sets the field instead, solve for focal length from sensor width, field of view and distance, then confirm the focus range covers every station:

Lens focal length, field of view and working distance
Units
Solve for
Focal length
– mm
Field of view
– mm
Working distance
– mm
Magnification
– x
Angle of view
– °
Pixel on the part
– mm

Thin-lens model: m = sensor width / field of view, f = WD × m / (1 + m). Accurate to a few percent above about 150 mm; check the lens's minimum object distance.

Find lenses with this focal length Open the full calculator

Repeatable distances matter as much as the glass. Put the camera on a camera stand with a graduated column and log the reading per frame; freehand positions drift a few percent, and the ROI drifts with them. The full selection routine, from sensor format to aperture, is in the machine vision lens focal length guide, and the working f-number and magnification article covers the depth-of-field cost of refocusing between stations.

A wide field with one uniform scale wants low distortion rather than per-frame correction. The LS-FFL-0567 holds distortion below 0.3% at 16 mm focal length on a 1.1-inch sensor.

Machine vision lenses16 mm, 1.1", 20 MP, C-mount machine vision lens, F2.8-22, <0.3% distortion (LS-FFL-0567)LS-FFL-0567
Type
Machine vision fixed
Sensor format
1.1"
Mount
C-mount
Resolution
16-25 MP
$679.00View partBuild a system with it

Where one number per frame stops holding

Four conditions break the single-scale model. Close range forces the exact form: the shortcut error equals f / u, so it stays under 2% only past 50 focal lengths (2500 mm for a 50 mm lens) and under 5% past 20 (1000 mm). Principal-plane offset comes next: a datasheet working distance runs from the barrel front, while u runs from the principal plane, tens of millimetres behind it on a typical FA barrel. An ignored 30 mm offset at station 1 makes m read 0.200 where the part is really imaged at 50 / 280 = 0.179.

Third, perspective on part height: a feature 10 mm above the plane sits 10 mm nearer, so at station 1 its scale rises to 50 / 240 = 0.208, 4% above the plane's 0.200; at station 2 the same feature sits 2% high. Flat parts forgive this; tall ones need the object plane calibrated or fixed-magnification optics.

Fourth, zoom and varifocal lenses breathe: focal length shifts a few percent as focus or zoom changes, so re-measure the scale per station, as covered in the zoom lens working distance extension guide. For stations that move continuously, a liquid lens autofocus holds focus while the scale follows the same equation per frame.

One design removes the distance question outright. An object-side telecentric lens holds one magnification across its depth range, so the ROI stays constant in pixels at every allowed working distance. The LS-TCL-0574 holds 0.4x at a 227 mm working distance on a 1.2-inch format.

Machine vision lensesFixed-magnification lens, 0.4x, 227 mm WD, 1.2" (LS-TCL-0574)LS-TCL-0574
Sensor format
1.2"
Mount
C-mount
Image circle
16-22 mm
$2,269.00View partBuild a system with it

Decision, then the bench

If every station distance is known and the part is flat: compute m per frame, scale the region by (u1 - f)/(u2 - f), and prove it with one ruler shot at the two extreme distances. If distances go unrecorded or the part is tall: measure the scale per station from any feature of known size. If the field is wide and the scale must hold edge to edge: choose low-distortion or fixed-magnification glass.

Choose the lens from the machine vision lenses range or the lens finder, or start the lens step of the configurator with your sensor and station list.

Questions

How accurate is the shortcut m = f / WD?

It always reads low because it drops the -f term. At the near station a 50 mm lens gives m = 0.200 by the exact form but 0.167 by the shortcut, 17% off. The error equals f / u: 5% at 20 focal lengths of distance, 2% at 50. Treat the shortcut as a long-range field-of-view estimate and compute m = f / (u - f) wherever it sizes a region.

How do I get the scale without a ruler or the focal length?

Use any feature of known size. A 12.70 mm gauge block spanning 737 px gives 58.0 px/mm, and m = 58.0 x 0.00345 mm = 0.200 for a 3.45 um sensor. With no known size, match two features that appear in both frames: their pixel-distance ratio equals (u1 - f)/(u2 - f), the scale you need, even when neither station distance is known.

Does refocusing between stations change the focal length?

Not on a fixed-focal-length lens: focusing only moves elements to satisfy the lens equation at the new distance, and the focal length stays with the glass. Zoom and varifocal models are the exception, since many shift effective focal length by a few percent across their focus travel. For those, re-measure the scale at each station or budget a matching error of the same order.

Which distance does the formula use, barrel front or principal plane?

The thin-lens equation wants u from the front principal plane, while a datasheet working distance runs from the barrel front, so u = WD + offset. Find the offset once per lens: image a ruler at a known barrel-front distance, measure the true scale, and back out u from m = f / (u - f). A 30 mm offset at the near station moves m from 0.200 to 0.179 on a 50 mm lens, about 12%.

Do I still need per-station scaling with a telecentric lens?

No. An object-side telecentric or fixed-magnification lens holds one magnification across its rated depth range, so a feature images at the same pixel span from any allowed working distance. Define the ROI once in pixels and reuse it for every frame; the distance errors above disappear. Check the rated depth range covers your station spread before committing.

Can I resize the whole frame instead of scaling the region?

For viewing, yes; for matching, it wastes resolution and hides errors. The 600 mm frame carries a 93.5 mm field against 42.5 mm at the near one, so matching scales means shrinking it to 45% and discarding more than half the pixels. Scale only the ROI to keep native pixels in every frame, and let a ruler shot catch any scale error before it becomes a soft match score.