Machine Vision

Depth of Field Calculator

Estimate near and far focus limits, total depth of field, and hyperfocal distance for machine vision lenses.

Machine vision workflowStep 5 of 6

  1. Size lens
  2. FOV specs
  3. Resolution
  4. Cell layout
  5. 5Focus
  6. Bandwidth

Next workflow step

Continue to Camera Bandwidth Calculator2448x2048 resolution · 30 FPS

Continue
Inputs
Lens, aperture, and focus distance.
mm
f/#
mm
mm
Results
Acceptable focus range around the subject plane.
mm
mm
mm
mm
mm
%
How it works: Uses standard thin-lens DoF formulas. Circle of confusion defaults to sensor diagonal / 1500 when left blank. Results assume focused at the subject distance.

Learn about this tool

What it is, when to use it, formulas, and common questions

What is this?

Calculates near/far focus limits, total depth of field, and hyperfocal distance for a given lens and aperture.

When do engineers use it?

Use when object height varies (e.g. stacked products) or when you need to confirm the full part stays sharp.

Formula

Total DoF depends on focal length, f-number, subject distance, and circle of confusion.

Example

At f/8 and 400 mm WD, a 25 mm lens may give ~40 mm total DoF — check against your tallest product.

FAQ

What circle of confusion should I use?
For machine vision, CoC is often tied to pixel size (roughly 1–2 pixels). A smaller CoC (stricter sharpness) shrinks DoF. If you are unsure, start near your pixel pitch.
Will stopping down always keep the part in focus?
Smaller apertures increase DoF but add diffraction blur and need more light or exposure. Past f/8–f/11 on small pixels you can lose the resolution you just gained.
Is hyperfocal distance useful on a factory camera?
Sometimes, for large working distances. On typical 300–800 mm inspection mounts, compute near/far limits against part height instead of relying on landscape-style hyperfocal rules.
Does sensor size change DoF?
Indirectly. A different sensor with the same lens changes FOV and often the CoC you should use. Recalculate when you change format, not only when you change f-number.