DEPTH
  • Aaperture
  • Ffocal length
  • Ddistance
  • Ppixel size

Depth of Field and Where It Bites

Generic engineering material, applicable to any module from any supplier.

For a separate reference on team workflow and work records, see learn more.

Only one plane is truly in focus. Depth of field is the zone either side of it within which the blur is small enough not to matter — and "small enough" is defined by your pixels and your task, not by the lens.

What widens it

A smaller aperture, which is the main control and costs light in direct proportion.

A shorter focal length. Wide lenses have more depth of field than narrow ones at the same aperture and distance.

For broader technical context, see DigiKey.

A greater working distance. Depth of field grows rapidly as the subject moves away and collapses as it comes close.

And a lower resolution requirement, since the acceptable blur is defined relative to the pixel size — a finer sensor has less depth of field for the same optics, which surprises people.

Where it bites

Close-up inspection. At short working distances the zone can be a millimetre or less, which means a part sitting slightly proud or a conveyor with vertical play produces images that are sharp sometimes.

Deep objects. A field of view calculated for the near surface does not necessarily focus the far one, and the geometry compounds with the coverage question.

Angled surfaces, where near and far edges of the same face sit at different distances.

And any system where the part position is not tightly controlled, which is most systems until somebody checks.

The intermittent failure it produces

A system that works on most parts and fails on some, with no pattern anybody can see.

Because the parts differ in height, or the fixture has play, or the conveyor sags in the middle — and each moves the subject out of the zone occasionally.

Which gets diagnosed as an algorithm problem for weeks, since the failing images look almost right.

The test is direct: photograph a target at the near limit, the nominal distance and the far limit of the part's actual variation, and measure the resolution at each rather than looking.

Fixed focus and what it fixes

A module with a fixed focus is set at manufacture to a particular distance.

Which is a reliability advantage — no mechanism, no drift, no adjustment to lose — and a constraint: the working distance is decided when the part is ordered.

Where the distance is known and stable, fixed focus is the better engineering choice, and it is why so many industrial modules are supplied that way.

Where it is not, the alternatives have their own costs and the choice belongs early rather than after the mechanics are built.

The circle of confusion

The name for how much blur counts as acceptable, and it is the term that makes published depth of field figures difficult to use.

A figure quoted by a lens supplier assumes a value for it — frequently one derived from human viewing of a print, which has nothing to do with machine vision.

For your system the acceptable blur is a pixel or two, which is generally far stricter than the assumption behind a published number.

Which means a supplier's depth of field figure is usually optimistic for measurement work, sometimes by a wide margin, and the practical answer is to measure it rather than to take it.

Hyperfocal distance

The focus setting at which everything from roughly half that distance to infinity is acceptably sharp.

Useful for wide-angle modules watching a general scene — a fixed-focus module set this way covers the maximum total range.

Useless for close-up work, where the subject is far nearer than the hyperfocal distance and the technique does not apply.

Which is a distinction worth knowing when reading advice, since much of what is written about depth of field is written for photography at distances industrial inspection never uses.

Buying depth of field with light

The trade is direct and it is the practical lever.

Closing the aperture two stops widens the zone substantially and cuts the light to a quarter.

Which is affordable where illumination is controlled and unaffordable where it is not — and is the clearest illustration of why lighting design and optical design are one job.

Adding light to buy depth of field is a routine and effective move that gets skipped because the two are specified by different people.

Stating it as a requirement

"The system must resolve the feature anywhere within ±3 mm of nominal working distance."

Which is a testable statement, unlike "adequate depth of field", and it comes from the mechanical variation rather than from the optics.

Measure the variation first — how much the part height, the fixture and the transport actually move the subject — and the optical requirement follows.

Where nobody has measured it, that is the first task, and it frequently turns out larger than the design assumed.

Tilting the sensor

A technique worth knowing exists and rarely available on modules.

Tilting the sensor plane relative to the lens brings an angled surface into focus across its whole extent, which no aperture setting achieves.

It requires a lens and mount designed for it, which excludes most integrated modules — and where the problem is an angled surface, the practical answers are a smaller aperture or moving the camera to face the surface squarely.

Mentioned because reading about it can suggest an option that a fixed module does not offer.

In one line

Measure the actual variation in subject position first, and the optical requirement follows from it rather than the reverse.

The short version

  • One plane is in focus; depth of field is the zone where blur is small enough, defined by your pixels and task
  • It widens with a smaller aperture, a shorter focal length, a greater working distance, and a lower resolution requirement
  • A finer sensor has less depth of field for the same optics, which is counter-intuitive and real
  • It bites in close-up inspection, on deep or angled objects, and wherever part position is not tightly controlled
  • The failure is intermittent and looks like an algorithm problem, which is why it gets diagnosed slowly
  • Test by photographing a target at the near, nominal and far limits of the actual variation, and measuring each