Machine Vision Optics Guide

How to Choose Focal Length for Machine Vision: Formula, Sensor Size, and Selection Steps

Focal length is a geometry problem with a specific answer for each setup. This guide covers the formula, what effective focal length actually means, the full selection sequence, and when a telephoto is the right call.

By Max Henkart, Commonlands · Updated May 2026 · 10 min read

Five Commonlands M12 lenses arranged from short wide-angle to long telephoto by focal length

To choose a focal length for machine vision, start from three measured numbers: the scene width the camera must cover, the working distance from the front of the lens to the target, and the active width of your sensor. The required focal length is EFL = (WD × sensor_width) / FOV_width, valid for rectilinear lenses whenever the working distance is much longer than the focal length (nearly all machine vision setups).

Pick the nearest stock focal length, then verify distortion, depth of field, and image circle before ordering. The field of view calculator checks any lens and sensor pairing in seconds.

How do I calculate the focal length I need?

Required focal length equals active sensor width multiplied by working distance, divided by required scene width. A 1/2.7" sensor (5.37mm active width) imaging a 120mm-wide part from 400mm needs (5.37 × 400) / 120 = 17.9mm, which makes 16mm and 21.8mm the practical high-resolution stock candidates.

EFL = (WD × sensor_width) / FOV_width EFL = required focal length (mm) · WD = working distance from the front of the lens to the target (mm) · sensor_width = active sensor width (mm) · FOV_width = required scene width (mm)
Technical note

For rectilinear lenses this geometry needs no distortion correction factor (Hecht, Optics, 5th ed., §5.2), but it assumes the working distance is much longer than the focal length. At short conjugates near 1:1 magnification, solve the thin-lens equation 1/f = 1/s + 1/s' directly. Fisheye and F-theta lenses use different projections. For those, use datasheet FOV values instead.

A Commonlands telephoto M12 lens with a tall barrel on a board-level camera
Longer focal lengths need longer barrels and narrow the field of view.

What is effective focal length?

Effective focal length (EFL) is the distance from a lens's rear principal plane to its focal point when the lens is focused at infinity. It is the parameter that sets field of view and magnification, and the mm value printed on a machine vision lens listing (6mm, 12mm, 35mm) is the EFL. EFL does not change with working distance. A 12mm lens stays a 12mm lens at 500mm or at 100mm, even though coverage and magnification shift.

Term What it is What it controls
EFL (effective focal length) Optical parameter of the lens prescription Field of view and magnification
BFL / MBFL (back focal length) Per-lens rear spacing dimension Holder and adapter clearance (whether the lens can reach focus)
FFD (flange focal distance) Mount standard specification Lens interchangeability (17.526mm C-mount, 12.526mm CS-mount, none for M12)

The EFL calculator runs the rectilinear math for common sensor formats and flags where the wide-angle caution applies.

How do you select a machine vision lens, step by step?

  1. Define the field of view. Write the scene dimensions in millimeters at the target plane, plus a 10–20% margin for placement tolerance. A 200mm-wide board becomes a 240mm design field.
  2. Measure the working distance. Working distance runs from the front of the lens to the target. It is a mechanical fact of the enclosure, arm, or gantry, measured rather than chosen. Commonlands M12 lenses focus from 50mm to infinity (uncorrected). C-mount working distance varies by product, typically 100mm to infinity. The working distance guide covers how this constraint hardens as a design matures.
  3. Pull the active sensor dimensions. Pixel count × pixel pitch from the sensor datasheet, never the nominal format label. The image sensor database lists active areas for common parts.
  4. Set the smallest feature to resolve. Divide scene width by horizontal pixel count for ground sampling distance (mm/pixel). Nyquist sampling sets a floor of two pixels across the smallest feature. The headroom you need above that floor depends on contrast, the algorithm, and your inspection or decoder vendor's minimum sampling spec. The spatial resolution guide covers the math.
  5. Calculate the focal length. EFL = (WD × sensor_width) / FOV_width, then shortlist the nearest stock values. The EFL calculator does this in one step.
  6. Choose the mount family. M12 fits compact, light, board-level builds. C-mount fits larger sensors, an adjustable iris, and cam-compensated refocusing. CS-mount sits between them. The lens mount guide compares thread, flange, and coverage in detail.
  7. Verify image quality. Run four checks: image circle at least as large as the sensor diagonal, distortion against the application's position-error budget, depth of field spanning the object height range (run the depth of field calculator), and lens MTF at the feature's spatial frequency (see the MTF curve guide).

Should you choose a short, medium, or long focal length?

Commonlands M12 lenses span all three focal length bands, and the medium range (5mm to 16mm) fits most factory inspection setups. Short focal lengths under 5mm buy scene coverage from close range at the cost of barrel distortion, with generous depth of field in return. Long focal lengths above 16mm buy pixel density and lower distortion at the cost of shallow depth of field. Start medium unless the geometry forces you elsewhere. The depth of field guide covers the long-lens trade.

Focal length range Field of view (relative) Distortion Depth of field Pixel density on target Typical use
Short (<5mm) Wide Higher Deep Lower Wide coverage, navigation, autonomous mobile robots (AMRs)
Medium (5–16mm) Moderate Moderate Moderate Moderate General inspection, barcode reading
Long (>16mm) Narrow Lower Shallow Higher Fine feature detection, metrology

The field of view column is deliberately relative, with no degree ranges, because the angle depends on the sensor as much as the lens: the same 12mm lens reads 25.2° on a 1/2.7" sensor and 33.3° on a 1/1.8" sensor. Treat the bands as guidance within one sensor format, and compute the actual angle for your lens with the angle of view calculator before classifying a candidate as wide or narrow.

Which M12 focal lengths cover most applications?

Three stock M12 lenses span the working range for most machine vision setups: 3.3mm for wide coverage, 6.2mm as the general-purpose default, and 12.5mm where pixel density matters. The full M12 catalog runs 0.8mm fisheye to 75mm telephoto.

Availability

Commonlands stocks roughly 70 M12 lens models in the US, most offered in several aperture and filter variants. Orders placed before 12 PM PST ship the same day from San Diego, CA.

Commonlands M12 lens options by focal length. Field-of-view angles are diagonal (DFOV), quoted across each lens's full image circle; horizontal coverage on a given sensor is narrower, so confirm it with the angle of view calculator.

Lens EFL Sensor format FOV (diagonal) Distortion Price Best for
CIL036 3.3mm 1/2.7" 89° at 6.4mm image circle -0.7% TV $19 Wide field with low distortion in tight installations
CIL062 6.2mm Up to 1/1.8" 60° at 7.2mm image circle -2% optical $19 Balanced general inspection and the default starting point
CIL125 12.5mm Up to 1/2" 35° at 7.9mm image circle -1.4% optical $39 Tighter field with higher pixel density for fine features and labels

TV distortion is measured as the image-height deviation at the frame edge, optical distortion against the paraxial ideal ray height, and F-theta distortion against the r = f·θ reference. Because the references differ, the percentages are not directly comparable row to row.

High resolution M12 Fisheye lens

191°@6.4mm Fisheye Lens

$70.00

Download .STPView Product
DSL210 DSL224 2mm S-Mount Lens IMX335 Framos

190°@6.8mm Fisheye M12 Lens

$49.00

Download .STPView Product
Basler Dart Camera IP67 M12 Lens

No Distortion 3.2mm Lens

$39.00

Download .STPView Product
Wide-Angle 4mm M12 Lens

Wide-Angle 4mm M12 Lens

$99.00

Download .STPView Product

Browse M12 Lenses (S-Mount Lenses) for Embedded Machine Vision

When should you choose a telephoto machine vision lens?

Choose a telephoto machine vision lens when the target is small or distant and the camera cannot move closer. As a rough guide, that means the target fills only a small fraction of the frame with the lens you have. Commonlands telephoto M12 options run 12.5mm to 50mm, with a 75mm model at the long end of the catalog. All of them trade scene coverage for magnification, tighter focus tolerance, and higher vibration sensitivity.

In machine vision, "telephoto" means any long-EFL lens used to reach or magnify a target, not the photographic construction where the barrel is shorter than the focal length. The geometry is the same formula as everywhere else on this page: doubling the EFL halves the linear field of view at the same working distance and doubles the apparent target size. Typical applications are aerial inspection from drones, traffic monitoring at distance, overhead conveyor lines, and barcode or OCR reading at long standoff.

Long lenses are less forgiving than short ones. Depth of field shrinks rapidly as focal length grows, so a focus setting that was easy at 6mm becomes critical at 35mm, and image shift from platform wobble scales with focal length, smearing at 50mm what looked sharp at 6mm. Plan stiffer mounts, lock focus after setting it, and re-verify after any mechanical service. The focusing guide covers the procedure.

Telephoto is also often the wrong answer: to monitor a wide area or run on a vibration-heavy platform, a shorter focal length tolerates the pointing error and motion that would push a narrow frame off target.

Near-focus behavior differs by mount. C-mount telephotos refocus through an internal cam that rebalances aberrations across the focus range, going uniformly soft inside the minimum object distance. M12 telephotos are rigid barrels with no hard stop, so short standoffs demand deep holders and close-range sharpness is limited by field curvature rather than center focus.

Choosing M12 or C-mount for telephoto work

Selected telephoto M12 lenses reach 1/1.7" sensor coverage in a fixed-aperture board-lens package, the right fit for drones, embedded systems, and weight-limited payloads. Move to C-mount when the sensor is larger, when you need an iris to stop down for depth of field, or when lighting is too dim to fix at a fixed aperture. The low-light section of the F-number guide covers that trade.

Commonlands telephoto M12 lenses from 12.5mm to 50mm, ordered by focal length.

Part EFL Format Resolution Aperture Price
CIL125 12.5mm Up to 1/2" 12MP Fixed $39
CIL121 21.8mm Up to 1/1.7" 12MP+ Fixed $70
CIL350 35mm 1/1.7" 8–10MP Fixed $59
CIL051 50mm Up to 1/1.8" 12MP Fixed $79

The resolution rating is the sensor resolution each design is corrected for across its image circle, not a lens output. Each pairs with a pixel pitch on the product page.

Commonlands CIL051 50mm telephoto M12 lens for large-format sensors up to 12MP
The 50mm telephoto M12 lens (CIL051) fits a board-lens package for aerial robotics and long-standoff inspection.

What if the calculated focal length does not exist?

Round to the nearest stock focal length and recompute the field of view. Rounding shorter gives extra coverage you can crop, which is the safe default when installation geometry is not yet locked. Rounding longer gives less coverage and is only acceptable once you have confirmed the scene still fits the sensor, which is the call when the feature to detect is small and resolution outweighs coverage. If neither works, a 10–20% working distance change usually closes the gap.

Commonlands stocks M12 focal lengths in discrete steps (2.6mm, 3.3mm, 3.6mm, 6.2mm, 8mm, 12.5mm, 14.2mm, 16mm, 18mm, 19mm, 21.8mm, 25mm, and up), so a calculated value will often land between them. The steps cluster tightly from 12mm to 25mm, where the nearest option usually sits within about 10% of the calculated value. Some intermediate steps, including the 18mm and 19mm options, are lower-resolution designs rated for 2MP sensors and below, so check the resolution rating before shortlisting.

Whatever the rounding decision, validate with physical test images before locking the design: mount the lens at the planned distance, image a calibration target or the real part, and confirm the features resolve and the scene fits. Test images catch corner vignetting, focus error at the target plane, and distortion in the actual part geometry that the math does not.

Three Commonlands M12 lenses, short, medium, and tall, showing how barrel length tracks focal length
Physical barrel length roughly tracks the focal length of a fixed lens.

Frequently asked questions

The Commonlands FOV calculator runs these formulas for any sensor; the answers below explain the math behind it.

How do I calculate focal length from field of view and working distance?

Multiply the active sensor width by the working distance and divide by the required scene width: EFL = (WD × sensor_width) / FOV_width. A 1/2.7" sensor (5.37mm active width) at a 400mm working distance covering a 120mm scene needs (5.37 × 400) / 120 = 17.9mm, so 16mm and 21.8mm are the high-resolution stock candidates (18mm and 19mm options exist as lower-resolution designs for 2MP sensors and below). The EFL calculator runs this directly.

What is effective focal length?

Effective focal length (EFL) is the distance from a lens's rear principal plane to its focal point when the lens is focused at infinity. It sets field of view and magnification. The mm value on a machine vision lens listing (6mm, 12mm, 35mm) is the EFL, not the back focal length and not the flange focal distance.

What steps go into machine vision lens selection?

Machine vision lens selection runs in a fixed order: define the required field of view, measure the working distance, and pull active sensor dimensions from the sensor datasheet. Then set the smallest feature to resolve, calculate focal length with EFL = (WD × sensor_width) / FOV_width, and choose the mount family. The final step is to verify image circle, distortion, depth of field, and MTF.

What are telephoto machine vision lenses?

Telephoto machine vision lenses are long focal length designs that produce a narrow field of view and higher magnification at a given working distance. Common telephoto M12 options run 12.5mm to 50mm and image small or distant targets (aerial inspection, traffic monitoring, long-standoff barcode reading) at the cost of tighter focus and vibration tolerances.

What happens if my ideal focal length does not exist?

Choose the nearest stock focal length and recompute the field of view. Rounding shorter adds coverage you can crop in software, which is the safer direction. Rounding longer cuts coverage and requires confirming the scene still fits the sensor. Adjusting the working distance by 10–20% often closes the gap exactly. Verify any candidate with the field of view calculator before ordering.

Get a focal length recommendation

Send your working distance, scene size, and sensor part number to the Commonlands engineering team in San Diego and they will run the numbers with you. Orders placed before 12 PM PST ship the same day.