Lenses & opticsGuide

Machine vision lens selection: focal length calculation

Machine vision lens selection by calculation: focal length = working distance × sensor width ÷ field of view, with a worked example and catalog-lens rounding.

LumaSpec Vision10 min read Share on LinkedIn

On this page 9 sections
  1. 01What formula does a lens-finder tool run?
  2. 02Which sensor width goes into the formula?
  3. 03How does the focal length calculation work on a real part?
  4. 04What if no catalog focal length matches?
  5. 05When does magnification replace focal length?
  6. 06How much field-of-view margin should you leave?
  7. 07When is the simple formula wrong?
  8. 08Which checks settle the order?
  9. 09Questions

A lens-selector program and a pencil do the same arithmetic. Machine vision lens selection comes down to one line: focal length equals working distance times sensor width, divided by field of view. Every configurator and lens finder wraps that line with filter checks, so once you can run it yourself you can size a lens from any catalog table, audit a vendor's pick, or rescue a project whose selector tool has vanished. What follows is the formula, a worked example with every step shown, the rounding rule, the margin rule, the telecentric exception and the checks that settle an order.

What formula does a lens-finder tool run?

A lens finder applies one line, f (mm) = working distance (mm) × sensor width (mm) ÷ field of view (mm), so a 6.4 mm sensor at 200 mm working distance looking at an 80 mm wide field returns f = 200 × 6.4 ÷ 80 = 16 mm. The tool adds nothing to the arithmetic; it filters catalog lenses around the result.

f = WD × sensor width ÷ FOV FOV = WD × sensor width ÷ f m = sensor width ÷ FOV

The rearrangements carry the rest. FOV = WD × sensor width ÷ f predicts what a given lens covers at your distance, and magnification m = sensor width ÷ FOV translates between the two languages catalogs speak — focal length for machine vision lenses, magnification for telecentrics. These are thin-lens estimates, good to a few percent wherever the working distance is many times the focal length, which describes most factory stations. The machine vision optics basics guide walks the same four quantities from scratch, and the focal length chooser ranks candidates once you hold the number.

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.

Which sensor width goes into the formula?

Use the sensor's active width in millimetres, never the inch type name: a 1/2-inch camera contributes 6.4 mm, a 2/3-inch camera 8.8 mm and a 1-inch camera 12.8 mm, and width, not diagonal, sets the horizontal field.

Sensor type Width (mm) Height (mm) Diagonal (mm)
1/3" 4.8 3.6 6.0
1/2" 6.4 4.8 8.0
1/1.8" 7.2 5.4 9.0
2/3" 8.8 6.6 11.0
1" 12.8 9.6 16.0
1.1" 14.1 10.3 17.5

Width drives the field; diagonal decides coverage, because the lens has to fill the corners. When the camera datasheet lists only resolution and pixel size, width in millimetres is horizontal pixels × pixel size ÷ 1000 — 2592 px × 2.5 µm = 6.48 mm, a 1/2-inch class sensor. The no-datasheet recovery guide shows how to pull all three numbers from an unmarked camera with a ruler.

How does the focal length calculation work on a real part?

A 60 mm wide bracket inspected at 220 mm working distance with a 1/2-inch, 5 MP camera needs f = 220 × 6.4 ÷ 90 = 15.6 mm, so the nearest catalog focal length delivers an 88 mm field and 14 mm of margin per side. The steps, with the arithmetic in full:

  1. Sensor width: 1/2-inch type → 6.4 mm.
  2. Required field: 90 mm — the 60 mm bracket plus placement error and edge context.
  3. Divide: f = 220 mm × 6.4 mm ÷ 90 mm = 1408 ÷ 90 = 15.6 mm.
  4. Compare catalog focal lengths: the nearest size gives FOV = 1408 ÷ 16 = 88 mm; 12 mm gives FOV = 1408 ÷ 12 = 117 mm.
  5. Margin at the catalog pick: (88 − 60) ÷ 2 = 14 mm per side, against about 5 mm of placement tolerance plus 0.1 mm of pixel context.
  6. Pixel size on the part: 88 ÷ 2592 = 0.034 mm per pixel — about 3 pixels on a 0.1 mm defect; object-space pixel size is the number to track when parts or cameras change.
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

A 5 MP 1/2-inch camera needs a lens that covers an 8 mm diagonal and resolves its pixels with contrast to spare. The LS-FFL-0567 is a 16 mm C-mount machine vision lens rated for 1.1-inch sensors, 20 MP, F2.8-22, with under 0.3% distortion. That covers the 1/2-inch camera with headroom on both image circle and resolution class.

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

What if no catalog focal length matches?

Round the focal length down, never up, because the field grows as the focal length shrinks: the calculation asked 15.6 mm, the nearest catalog lens leaves the field 2 mm short of the 90 mm target, and 12 mm overshoots to 117 mm while keeping the whole part visible.

When the working distance is negotiable, move the camera instead of the lens: the same catalog lens at 236 mm covers 94 mm (236 × 6.4 ÷ 16), and the field of view vs working distance guide plots that trade. Extension tubes push a fixed lens into higher magnification for close stations, at the cost of working distance and the printed specification — the spacers and shims guide carries that arithmetic. Varifocal lenses absorb prototyping, then lock to one focal length for production.

When does magnification replace focal length?

Measurement work skips the focal length formula and buys by magnification, because a telecentric's field is sensor width ÷ magnification: 0.5x on a 1-inch sensor images a 25.6 mm field and holds its size when the part moves closer or farther.

Telecentric catalogs lead with magnification, then image circle, then a fixed design working distance; the telecentric selection guide walks that order and the telecentric field of view calculation does the division for any pair. Two examples set the scale: 1x on a 2/3-inch camera images 8.8 mm, and 0.179x on the same camera images 49 mm (8.8 ÷ 0.179). Catalog working distances cluster from under 65 mm to over 200 mm, so mount space is usually the binding constraint, and the entocentric vs telecentric guide shows why the geometry suits gauging. For shiny parts pick a unit with a coaxial port: the LS-TCL-2194 combines 0.5x magnification, 110 mm working distance, a 1-inch image circle and a built-in coaxial light in one C-mount barrel.

Specification LS-TCL-2118 LS-TCL-0651 LS-TCL-1390 LS-TCL-2194
Sensor format 2/3" – 2/3" 1"
Max sensor size (dia. mm) 11.0 – 11 16.0
Magnification (x) 1 – 0.179 0.5
Working distance (mm) 108±2 – 260 110
Image-side F/# 7 – 8 8
Object-side telecentricity (deg max) 0.05 – – 0.08
Image-side distortion (% max) 0.04 – 0.17 0.03
Numerical aperture NA 0.0712 – 0.01118 0.03123
Object-side resolution (um) 4.7 – 30 10.7
Image-side MTF30 (lp/mm) 114 – 90 116
Front filter thread M30x0.5 – – M44x0.5
Total length TTL (mm) 105.1 – 184.8 274
Price $1,239.00 $969.00 $2,219.00 $1,539.00

All 4 share: Mount C-mount. Values as printed in each product's data sheet; open a part for its drawing and full specifications.

How much field-of-view margin should you leave?

Size each side of the part as placement tolerance plus about three pixels of inspection context: the bracket example carries 5 mm + 0.1 mm ≈ 5.1 mm of need against 14 mm available, so it passes with 9 mm spare.

In one line: required FOV = part width + 2 × (placement tolerance + 3-pixel context). This is where selection fails silently — the field covers the part but not the placement scatter. Refit the example with a shakier feeder holding a 70 mm part to ±10 mm: required FOV = 70 + 2 × 10.1 = 90.2 mm, the catalog pick misses at 88 mm, so the choice moves to 12 mm and a 117 mm field. The penalty is pixels: 117 mm ÷ 2592 px = 0.045 mm per pixel, about a third coarser than 0.034 mm. When the defect spec is small, tighter fixturing or a higher-resolution camera beats an oversized field.

When is the simple formula wrong?

The thin-lens line holds when the working distance is many times the focal length; it misleads at macro distances, on line scan cameras, on telecentrics, and wherever a datasheet measures working distance from an internal principal plane.

Close stations flip first: above roughly 0.1x magnification the f = WD × sensor ÷ FOV answer drifts, because spacing rather than nominal focal length sets the image — the magnification at different working distances guide shows when one world region still maps across lenses, and extension tubes finish the job. Line scan cameras size by another route: sensor width and line rate drive the pick, as the line scan field of view guide works out. And long-working-distance fixed lenses measure WD from the front principal plane, which on deep barrels can sit tens of millimetres behind the filter thread — mount to the printed reference, then close the last fraction of a millimetre with the flange distance and shim guide.

Which checks settle the order?

Six checks retire nearly every wrong lens: image circle at or above the sensor diagonal, resolution class at or above the camera's megapixels, a working distance range that holds your mount, a matching mount, an f-number set for depth of field, and a printed distortion figure whenever you measure.

  • Image circle ≥ sensor diagonal: an 8 mm circle on a 2/3-inch camera (11 mm diagonal) shades the corners.
  • Resolution class ≥ camera pixels: a 6-10 MP lens starves a 20 MP sensor's corners of contrast; the Airy disk guide sets the pixel-size ceiling.
  • Mount and flange distance: C-mount sits at 17.526 mm, CS-mount at 12.5 mm, so a 5 mm adapter re-focuses a mismatched pair.
  • f-number for depth of field: stop down two or three stops from wide open, then re-check the depth of field numbers — the cost is exposure time or light.
  • Distortion: 0.3% of the bracket field is a quarter-millimetre edge shift, fine for presence checks and coarse for gauging; measurement builds go telecentric or buy an explicit figure.
  • Filters: an IR-cut filter keeps color cameras honest, and a mono camera under red LED light pairs with a band-pass filter against ambient.

Order the mount, shims, calibration target or filter with the lens from lens accessories. The decisions, then: for the bracket, the 16 mm fixed lens at 220 mm — an 88 mm field, 0.034 mm per pixel, 14 mm of margin per side — is the order. For a gauging field near 19 mm on a 1-inch camera, a 0.66x telecentric at its 110 mm design distance is the shape of the pick once the distortion line reads under your tolerance. Run candidates through the lens finder, or configure the lens step by step and let the filters apply these checks; the lenses topic page collects the companion guides.

Questions

How do I find the sensor width when the camera datasheet lists only pixels and pixel size?

Multiply: width in millimetres = horizontal pixels × pixel size ÷ 1000. A 2592 × 1944 camera with 2.5 µm pixels is 2592 × 2.5 ÷ 1000 = 6.48 mm wide, a 1/2-inch class sensor; height works the same way, and diagonal = √(width² + height²) sets the coverage check against the lens image circle.

What focal length images a 400 mm wide field from 500 mm away?

Divide per sensor width. A 1/2-inch camera: f = 500 × 6.4 ÷ 400 = 8 mm, a catalog size. A 2/3-inch camera: f = 8.8 × 500 ÷ 400 = 11 mm, so the 12 mm lens covers 367 mm and an 8.5 mm covers 518 mm — pick by how much overshoot your pixels can afford.

Why does the real field of view come out a few percent smaller than the calculation?

Three offsets pull the real field inward: datasheet working distance runs from the front principal plane rather than the lens face, the focus ring sits slightly off the nominal distance, and distortion stretches pixels near the corners. Measure the field once with a ruler target at the part plane, note the error, and the formula becomes exact for that station.

Do telecentric lenses use the same formula?

No — telecentrics are bought by magnification: field of view = sensor width ÷ magnification, and working distance is a fixed design value you match to your mount. A 0.5x telecentric on a 1-inch camera sees 12.8 ÷ 0.5 = 25.6 mm at its printed design distance, which catalogs set anywhere from under 65 mm to over 200 mm.

Does a larger image circle give a larger field of view?

No. The image circle only says the lens covers the sensor; field of view comes from sensor width, focal length and working distance. A 1.1-inch-circle lens on a 1/2-inch camera still delivers the field the formula predicts — the extra circle is unused headroom, and the one real effect is that you may have bought a larger, longer lens than the camera needed.