Working Distance vs Depth of Field: What Each One Controls in Machine Vision

In brief: working distance (WD) is where the lens must sit relative to the part — a mechanical and geometric decision. Depth of field (DOF) is how much height variation around that position stays in focus — a tolerance decision. They interact but they are not the same dial: WD decides where the machine stops, DOF decides how much the part is allowed to move. Selecting a lens by matching only one of the two is the most common way an otherwise correct lens ends up on the wrong machine.

Working distance versus depth of field: two panels showing mechanical clearance and the in-focus band
Left: WD is the physical standoff between lens and part — set by the fixture, lighting and Z-travel. Right: DOF is the in-focus band — it decides how much height step stays sharp in one shot.

Part of the POMEAS Machine Vision Optics Comparisons series — see the Machine Vision Optics Comparisons index for all 15 articles in this set, grouped by the option being compared.

Two different questions

WD answers: at what distance must this lens be mounted to frame the part correctly? DOF answers: once mounted there, how much can the surface height change before focus fails? The first is a question about the machine; the second is a question about the part. A lens selection is only finished when both have been answered with numbers.

What working distance actually decides

Working distance is measured from the lens front (or its reference plane) to the object. In a real machine it is consumed from three directions at once:

  1. Mechanical clearance. Fixtures, clamps, lighting brackets and the Z-axis travel all live inside the WD. A lens whose WD is shorter than the stack-up simply cannot be mounted.
  2. Field coverage. FOV and magnification are tied to the lens design at its rated WD — operate a lens far from its rated WD and the designed magnification, distortion and telecentric range drift.
  3. Lighting geometry. Ring lights, coaxial collimators and flat domes each need their own standoff; the WD is the budget every lighting choice spends from.

What depth of field actually decides

Depth of field is the axial range around best focus within which the image stays acceptably sharp. For a given lens it is governed mainly by the f-number (aperture), the magnification and the wavelength — smaller aperture, lower magnification and longer wavelength each extend it. In production terms DOF absorbs:

  1. Part height variation — machining tolerance, warpage, inconsistent loading.
  2. Multiple features at different Z that must be judged in one shot instead of a refocus or a Z-stack.
  3. Stage flatness and repeatability — the mechanical error the optics never see but the focus does.

Practical rule: sum the part height tolerance + loading error + stage repeatability. That total must be smaller than the DOF — otherwise some parts will defocus no matter how carefully the lens is focused.

Side-by-side comparison

AspectWorking distance (WD)Depth of field (DOF)
Question it answersWhere does the lens sit?How much can the part move?
Set byLens design + your machine layoutAperture, magnification, wavelength
DecidesClearance, FOV at rated spec, lighting roomHeight tolerance absorbed in one shot
Typical failureLens cannot be mounted, or FOV drifts off designTop of part sharp, bottom blurred (or the reverse)
Extending itChoose a long-WD design — costs size and magnification headroomStop down, lower magnification, more light, Z-stack
Who sets it firstMachine designerPart + process engineer

How the two interact

They trade off indirectly. For a fixed magnification, extending DOF by stopping down costs light — and at long WD every lost stop must be bought back with brighter illumination or longer exposure, which risks motion blur on moving parts. Long-WD telecentric designs hold their measurement geometry across a defined WD range, which is why they are preferred when the machine cannot guarantee a tight WD — but no design escapes the aperture/magnification arithmetic of DOF. The order that works is: fix WD from the machine, fix required DOF from the part, then choose the lens family and aperture that satisfies both — not the other way around.

A selection sequence that avoids the trap

  1. Measure the machine first. Clearance above the part, lighting stack, Z-travel: this gives the minimum acceptable WD.
  2. Measure the part second. Height step between the lowest and highest feature that must be sharp in one image: this gives the required DOF with margin.
  3. Then pick the optics. Compare candidate lenses at their rated WD, check DOF at the aperture you can afford to run, and verify the FOV still covers the part.
  4. Prove it once, mechanically. Focus on a part at the middle of the height tolerance, then image parts at both extremes before releasing the design.

Frequently asked questions

Should I choose the working distance or the depth of field first?

Choose the working distance first, because it is bounded by the machine: if the WD does not clear the fixture and lighting, the lens cannot be installed at all. Then check depth of field against the part height variation, and change the lens or aperture if the DOF is too small for the process.

Does a longer working distance automatically increase depth of field?

No. For a given magnification, DOF is governed mainly by the aperture, magnification and wavelength, not by the WD number itself. Long-WD lenses help when the machine needs the clearance and when a telecentric design must hold its geometry over a WD range, but a long WD alone does not buy focus depth.

Why is the top of my part sharp but the bottom blurred?

That is the classic signature of a height step larger than the depth of field: both surfaces are imaged, but only the one near best focus is sharp. The options are a smaller aperture, a lower magnification, a lens with more DOF, splitting the field into Z-stacks, or refocusing between surfaces if the cycle time allows.

How can I get more depth of field without changing the lens?

Stop the aperture down one or two steps and compensate with more illumination or a longer exposure, because aperture is the strongest lever on DOF you can operate without touching the optics. Reducing the magnification also helps, but that changes the field coverage, so it is a selection decision rather than a tuning one. For a concrete part, send us the height tolerance and the machine envelope.

Related products and reading

  • Industrial lenses — zoom, FA and telecentric families with WD and DOF as rated selection parameters.
  • Machine vision systems — integrated optics, lighting and cameras engineered around a fixed WD.
Go Back Top
VK Message
WhatsApp

Scan QR Code

WhatsApp QR Code
Wechat

Scan QR Code

Wechat
Phone Number
+8618598102007
Copied!
Online Message

Online Message

Click to refresh