Machine Vision Lens & Camera Calculator
Choose a camera sensor, a lens and an object, and see immediately what the camera will see: field of view, millimetres per pixel, depth of field, diffraction, exposure time and noise. The preview simulates the real image pixel by pixel, so you can judge whether a scratch, a label or a 0.5 mm feature will really be visible, before you buy any hardware.
Try it
Calculations run on our server; the preview is rendered in your browser (WebGL 2). Preset values are typical datasheet figures - check the datasheet of your exact model before buying.
Why a calculator before buying a camera?
Most failed vision projects do not fail because of the software. They fail because the camera, lens and working distance were chosen from a catalogue without checking the optics: the part does not fit the frame, the defect is smaller than two pixels, the depth of field is too shallow for parts that vary in height, or the exposure is too long for a moving conveyor. Ten minutes with this calculator answers those questions up front.
Will the defect be visible?
Read the object sampling (mm/px) and the smallest detail. A defect should cover at least 3-5 pixels for reliable detection - the preview shows exactly how it will look.
Choose the working distance
Enter the part size and find the distance and focal length that fill the frame without cropping, including how much space you need above the conveyor.
Enough depth of field?
Parts that vary in height or sit at an angle need a deep sharp zone. See how stopping down helps - and where diffraction starts to cost resolution.
Light and motion
Check exposure time and SNR for your illumination level. If the exposure is too long for the line speed you know you need more light, a faster lens or a larger pixel.
Avoid buying twice
Compare a Raspberry Pi camera with an industrial global-shutter sensor, or a cheap M12 lens with a C-mount lens, before ordering anything.
Talk with numbers
Share the values with your integrator or with us. A concrete setup makes quotes faster and more accurate.
How to use it in 4 steps
- 1
Pick the object
Use a preset (coin, card, test chart, pallet ...) or a custom box with your part's dimensions.
- 2
Set sensor and lens
Choose a preset or enter pixel size, resolution, focal length, aperture and image circle from the datasheet.
- 3
Adjust distance and angle
Move the camera until the object fills the frame. Watch the warnings for image circle, focus and diffraction.
- 4
Pixel-peep
Zoom to 100 % or 800 % in the preview to see whether text, edges and small defects are still resolved.
What is calculated
Thin-lens model with focus-dependent magnification and effective f-number, rectilinear or fisheye projection, radial distortion, lateral chromatic aberration, cos⁴ and image-circle vignetting, defocus blur from the real aperture, diffraction (Airy disk), pixel sampling, photon shot noise, read noise and full-well saturation. Not modelled: Bayer demosaicing and lens-specific aberrations such as coma, astigmatism and field curvature.
Frequently asked questions
How many pixels does a defect need to be detected?
As a rule of thumb, at least 3 pixels across for presence detection and 5-10 pixels for reliable classification. For measurement tasks plan with sub-pixel methods and at least 10 pixels per tolerance band.
How do I calculate the field of view?
For a rectilinear lens: field of view = sensor size × working distance / image distance. The calculator also accounts for the focus distance (image distance grows when focusing closer) and for fisheye projection.
Why does a smaller aperture not always give a sharper image?
Stopping down increases depth of field, but diffraction grows with the f-number. Once the Airy disk is larger than about 2-4 pixels, resolution drops. The calculator warns you when that happens.
Is a Raspberry Pi camera good enough for industrial inspection?
Sometimes - for slow processes and good light. Small pixels mean more noise and rolling shutter means distortion on moving parts. Compare a Pi sensor with a global-shutter sensor like the IMX264 in the calculator.
Can you design the complete system for us?
Yes. AfaTech plans camera, lens, lighting, mechanics and the AI software as one system, and delivers on-site or remote.
Need help choosing the right setup?
Send us your part, cycle time and defect examples. We design camera, optics, lighting and AI inspection as one system.