Machine Vision Lenses: Focal Length, Field of View and Telecentric Optics

Written by Sciotex Engineering
In this article

A machine vision lens is chosen from four numbers: the field of view, the working distance, the sensor size and the smallest feature you must resolve. Together they set the focal length, the magnification and how sharp the lens must be. A fixed focal length lens suits most inspections; a telecentric lens is the choice when parts move toward or away from the camera and you must measure them.

This article is part of our machine vision guide. It is written for engineers specifying optics for inspection and measurement, and includes a calculator for a first estimate.

In short

  • Magnification is sensor width divided by field of view.
  • Focal length follows from magnification and working distance.
  • The lens must resolve the sensor’s pixels, or extra megapixels are wasted.
  • Depth of field grows as you close the aperture, at the cost of light and sharpness.
  • Telecentric lenses keep size constant with distance, which matters for gauging.

The terms that drive lens selection

TermWhat it meansWhy it matters
Field of view (FOV)The area of the part the camera seesWith sensor pixels, sets the size of one pixel on the part
Working distance (WD)Lens front to the partLimited by fixtures, guards and access
Focal lengthThe lens’s optical power, in mmShorter focal length gives a wider view at the same distance
MagnificationSensor size divided by FOVLinks the part to the sensor
Image circle and mountThe area the lens covers, and its thread (C-mount, F-mount and others)Must cover the whole sensor without dark corners
Resolving powerThe finest detail the lens transfers, in line pairs per mmMust match the pixel size
Aperture (f-number)How wide the lens opensTrades light for depth of field
DistortionHow straight lines bend near the edgesMatters for measurement; can be calibrated out

Working out the focal length

Start with magnification: sensor width divided by field of view width. A 2/3 inch sensor about 8.8 mm wide imaging a 100 mm field gives a magnification of 0.088. For a simple lens model, focal length is about working distance × magnification ÷ (1 + magnification). At 300 mm working distance that is about 24 mm, so a 25 mm lens is the nearest standard choice. Real lenses differ from the thin-lens model, so treat it as a starting point and confirm with the maker’s data.

Field of view, resolution and lens calculator

An estimate for planning. Confirm the final lens with the lens maker’s data and a test on real parts.

Resolution: matching the lens to the pixels

A sensor can only use the detail the lens delivers. The finest pattern a sensor can record is one line pair across two pixels, so a sensor with 3.45 µm pixels needs a lens that resolves about 145 line pairs per mm. Small-pixel, high-megapixel sensors need lenses designed for them. Pixel count itself is covered in machine vision camera resolution.

Depth of field and aperture

  • Closing the aperture (a higher f-number) increases depth of field, which helps when part height varies.
  • But it costs light, so exposure gets longer or lighting must be brighter.
  • And past a point it costs sharpness, because diffraction blurs fine detail. Small pixels feel this first.
  • Lower magnification also increases depth of field, if you can afford the larger pixel size on the part.

Telecentric lenses

With an ordinary lens, a part looks bigger as it moves closer. A telecentric lens views the part with parallel rays, so its size in the image stays the same across a range of distances, and cylinders and holes are seen straight on rather than at an angle. That makes telecentric lenses the standard choice for precise gauging. The trade-offs: the front of the lens must be larger than the field of view, so they suit small parts, and they are larger and heavier. See machine vision metrology.

Other optics worth knowing

  • Macro lenses for magnifications near 1x on very small parts.
  • Extension tubes and spacers to focus closer, at the cost of image quality.
  • Filters on the lens to pass only the lighting wavelength or cut glare. See light colors and wavelengths in machine vision and polarization.
  • Liquid lenses that refocus electronically for parts of different heights.
  • Protective windows in washdown or dusty areas.

Common lens mistakes

  • Using a lens whose image circle is smaller than the sensor, causing dark corners.
  • Putting a low-resolution lens on a high-megapixel camera.
  • Closing the aperture for depth of field until diffraction softens the image.
  • Measuring parts at varying distance with a standard lens instead of a telecentric one.
  • Choosing a working distance with no room for lighting, guards or maintenance.

Need help specifying optics?

Sciotex tests lenses, lighting and cameras on your sample parts, free of charge, and recommends a setup from any brand.

Talk to an engineer

Frequently asked questions

How do I choose a lens for machine vision?

Work out magnification from sensor width and field of view, then focal length from magnification and working distance. Then check that the lens covers the sensor, resolves its pixels, and gives enough depth of field at a usable aperture.

How do I calculate focal length for a machine vision lens?

Magnification is sensor width divided by field of view. Focal length is about working distance × magnification ÷ (1 + magnification). Round to the nearest standard lens and adjust the working distance.

What is a telecentric lens used for?

A telecentric lens keeps a part the same size in the image even as its distance changes, and views it straight on. It is used for precise dimensional measurement of small parts.

What does lp/mm mean for a lens?

Line pairs per millimeter is the finest pattern of black and white lines a lens can transfer. It should be at least 1 ÷ (2 × pixel size) for the camera’s sensor, or fine detail will be lost.

How can I increase depth of field?

Close the aperture to a higher f-number, reduce magnification, or use a lens designed for depth. Closing the aperture costs light and, past a point, sharpness due to diffraction.

Related articles

Written by

Sciotex Engineering

The Sciotex engineering team has designed and built vision, automation and test systems since 1997.

Have an inspection problem to solve?

Talk it through with a Sciotex engineer.

In this article
Have an inspection problem to solve?

Talk it through with a Sciotex engineer.

Next step

See what a vision system could do on your line