Automation Glossary • Depth of Field

What Is Depth of Field in Machine Vision?

Merobix Engineering • • 7 min read

Depth of field is the band of distances within which a part looks acceptably sharp, and it is a constant source of tension in vision setups because you cannot deepen it for free. Stopping the aperture down widens the band and keeps more of the part in focus, but it also starves the sensor of light, forcing brighter illumination or a longer exposure. The moment a part has any height variation, tilt, or bulk, a shallow band of focus starts causing blurry regions and false rejects. This guide explains what depth of field is, why it trades directly against light, where it bites in real inspections, and the practical levers for extending it.

Back to Blog

Depth of Field in one line: Depth of field in machine vision is the range of distances, from nearer to farther than the focus point, over which the part remains acceptably sharp. It is set largely by the lens aperture: stopping down to a higher f-number deepens the field so more of the part stays in focus, but it also reduces the light reaching the sensor, forcing brighter lighting or longer exposure. It matters most for parts with height variation, tilted surfaces, or bulk, where too shallow a focus band causes blur and false rejects.

The Range Where the Part Stays Sharp

A lens is focused at exactly one distance, but sharpness does not collapse instantly on either side of it. There is a zone in front of and behind the focus point where the image is still acceptably sharp for the inspection, and the depth of that zone is the depth of field. Anything within the zone looks crisp enough to measure or judge, while anything outside it becomes progressively blurred. In machine vision, acceptable sharpness is defined by the task, since a defect that must be resolved to a fine level of detail demands a tighter standard of sharpness than a coarse presence check, so the same optics can offer a deeper usable field for an easy job than for a demanding one.

The main control over depth of field is the lens aperture, described by its f-number. A small aperture, which means a high f-number, produces a deep field where a wide range of distances stays sharp. A large aperture, which means a low f-number, produces a shallow field where only a narrow band around the focus distance is sharp. So an integrator who needs more of the part in focus reaches first for a higher f-number, stopping the aperture down to widen the zone of acceptable sharpness. This is the same physics photographers use, applied to the specific tolerances of an inspection.

Depth of field also depends on the imaging geometry, not only the aperture. Higher magnification generally shrinks the depth of field, so a system imaging small features at high magnification has an inherently shallow band and has to fight harder to keep a three-dimensional part sharp. This is why depth of field is often most painful in exactly the precision, high-magnification work where sharpness matters most, and why it cannot be treated as an afterthought once magnification is high.

The Trade-Off With Light

The reason depth of field is a constant tension is that the main lever for deepening it, stopping the aperture down, directly reduces the light reaching the sensor. A smaller aperture lets less light through, so an image that was correctly exposed at a wide aperture becomes dark when the aperture is closed to gain depth of field. You cannot simply have a deep field for free; you pay for it in light, and that payment has to be made up somewhere or the image becomes too dark and noisy to inspect reliably.

There are two ways to make up the lost light, and both have costs of their own. The first is to add more illumination, using brighter lighting so that enough light reaches the sensor even through the small aperture. This is often the cleanest answer, but brighter lighting costs money, generates heat, and can be limited by what is physically possible in the space. The second is to lengthen the exposure so the sensor collects light for longer, but a longer exposure risks motion blur on any moving part and slows the inspection rate, which may be unacceptable on a fast line.

So the depth-of-field decision is really a three-way balance between focus depth, light, and speed. Deepen the field and you need more light or more time; keep the exposure short for a fast moving line and you need either a brighter light or a shallower field; economise on lighting and you are pushed toward a wider aperture and less depth. Every vision setup lands somewhere in that triangle, and much of the art of specifying a system is finding the point where the part stays sharp across its whole depth, the image is bright enough to be clean, and the inspection still keeps up with the line.

Where It Bites, and the Field-Operations Angle

Depth of field turns from theory into false rejects the moment the part is not flat. A part with height variation presents surfaces at different distances from the lens, and if the depth of field is too shallow, some of those surfaces fall outside the sharp band and blur, so features on them cannot be measured or judged and the part may be failed for a fault that is really just blur. Tilted surfaces do the same thing across a single face, with one edge in focus and the other out. Bulk product, such as items heaped or stacked at varying heights, is a classic case where a shallow focus band cannot keep the whole scene sharp at once.

The practical levers for extending depth of field follow from its causes. Stopping the aperture down is the first and most direct, accepting the need for more light. Reducing magnification, where the task allows, deepens the field because lower magnification carries a naturally larger depth of field. Arranging the part so its critical features sit at a similar distance, by presenting it in a consistent orientation, keeps everything within the sharp band. And where the part genuinely spans more depth than any single focus can cover, more specialised approaches such as a telecentric lens or capturing and combining multiple focus settings can extend or side-step the limit, at added cost and complexity.

Because a shallow depth of field produces false rejects rather than obvious failures, its effects often reveal themselves in the numbers rather than at the station. A vision check that blurs part of a tall or tilted product fails good parts, and that inflated reject rate is exactly the kind of signal that shows up when inspection results are gathered and trended. A cloud SCADA platform such as Merobix collects those pass and fail counts centrally, so a supervisor watching from a control room or a phone can see a station's reject rate sitting stubbornly high and ask why, which often traces back to an imaging issue like insufficient depth of field. Getting the depth of field right is the optical work; the monitoring layer is where the cost of getting it wrong becomes visible across the operation.

Frequently Asked Questions

How do I increase depth of field in a vision system?

The most direct lever is to stop the aperture down to a higher f-number, which widens the range of distances that stay sharp, at the cost of less light. You can also reduce magnification where the task allows, present the part so its critical features sit at a similar distance, or use specialised approaches such as a telecentric lens or combining multiple focus settings for parts that span more depth than one focus can cover. Each option trades against light, speed, or cost.

Why does a smaller aperture make the image darker?

A smaller aperture, meaning a higher f-number, physically lets less light through the lens to the sensor. So while stopping down deepens the depth of field, it also reduces the light in the image, which can make it too dark and noisy to inspect. You compensate by adding brighter lighting or by lengthening the exposure, though a longer exposure risks motion blur and slows the inspection rate.

Why does part height variation cause false rejects?

A part with height variation presents surfaces at different distances from the lens, and if the depth of field is too shallow, some of those surfaces fall outside the sharp band and blur. The vision system may then fail the part for a fault that is really just blurred detail rather than a real defect. Extending the depth of field, or presenting the part so its critical features sit at a similar distance, avoids these false rejects.

From Definitions to a Live Dashboard

Merobix reads your field devices into a cloud SCADA - the real thing behind these terms, live in days from any browser.

Request a Free Demo +1 (903) 307-7300
More in Automation Glossary
Machine Vision Lighting  •  Backlight vs Front Light  •  Dark-Field vs Bright-Field  •  Pattern Matching  •  Blob Analysis  •  Sub-Pixel Edge Detection  •  All Automation Glossary →
Free SCADA operator training
Merobix University - 70 video lessons & 261 quiz questions, from first login to compliance reporting. No demo call required.
Start free →