Machine vision is one of the most commercially successful applications of computer vision, and one where the discipline is almost entirely in the physical setup rather than the software.
Imaging is the whole game
Lighting is the highest-leverage variable, and the one most often treated as an afterthought. The illumination geometry determines which defects are visible at all:
- Bright field — direct illumination. Good for contrast on printed features and gross geometry.
- Dark field — grazing angle. Surface scratches and edge chips light up dramatically.
- Backlight — silhouettes. Best for dimensional measurement and through-holes.
- Diffuse dome — even, shadowless. Good for specular and curved surfaces.
- Structured light — projected pattern. Recovers 3D shape and surface deformation.
A defect invisible under one geometry is often obvious under another. Before any modelling, test several.
Optics and sensor. Resolution must place the smallest defect across several pixels, not one — a single-pixel feature is indistinguishable from sensor noise. Depth of field must cover the part's positional variation. Telecentric lenses remove perspective error for measurement work.
Motion. Line speed sets exposure time, which sets the required illumination intensity. Strobed lighting synchronized to a position trigger freezes motion without blur.
Fixturing. Every mechanical constraint you add removes a variable the model would otherwise have to learn. Consistent part presentation is worth more than a larger training set.
The diagnostic that saves months: photograph 50 known-defective parts with your intended setup and ask a human to find the defect in the images. If they cannot, the problem is optical, and no amount of model work will fix it.
Classical vision vs deep learning
Deep learning is not universally better here, and reaching for it first is a common and expensive error.
| Task | Better approach |
|---|---|
| Dimensional measurement, tolerances | Classical — edge detection, subpixel fitting. Deterministic, traceable, calibratable |
| Presence/absence, counting | Classical — usually simpler and faster |
| Barcode, OCR on marked parts | Classical — purpose-built, decades mature |
| Alignment, pose estimation | Classical — template and feature matching |
| Surface defects, texture, cosmetic | Deep learning — hard to specify with rules |
| Novel or unspecified defects | Deep learning — anomaly detection |
| Highly variable natural products | Deep learning |
Classical vision is deterministic, auditable, and calibratable against a traceable standard — which matters enormously in regulated manufacturing. Deep learning earns its place where the defect cannot be written down as a rule.
Many strong production systems use both: classical vision for measurement and alignment, a learned model for cosmetic judgement.
The defect rarity problem
At realistic scrap rates you will not have enough defect examples to train a classifier per defect type. The usual resolution is anomaly detection — train on good parts only, flag deviation. You have unlimited good examples, and it catches defect types you have never seen.
The tradeoff is localization and specificity: it tells you a part is abnormal, not what is wrong with it. In practice this is acceptable, because the part is going to a human review station anyway.
Deployment realities
Inference runs at the line for latency and reliability reasons, which bounds model size. Drift is physical — vibration loosens mounts, dust accumulates on lenses, bulbs shift colour temperature as they age, suppliers change material finish. Monitor the input image statistics, not just output accuracy; distribution shift in the images is the earliest warning you get.
And operator trust is a real engineering requirement. Show why a part failed with the region highlighted, and provide a logged override. A system operators do not trust gets bypassed.
Frequently asked questions
How fast can machine vision inspect?
Thousands of parts per minute for simple classical checks with line-scan cameras. Deep learning inference at the edge typically handles tens to low hundreds of parts per second depending on model size and hardware. Throughput is usually limited by material handling rather than by vision.
Can machine vision measure dimensions accurately?
Yes, to very tight tolerances with telecentric optics, proper calibration against a traceable artifact, and controlled lighting. This is classical vision territory and is well-established in metrology. Use deterministic algorithms rather than learned models for anything requiring traceable measurement.
How much does an inspection system cost?
Hardware for a single station — camera, lens, lighting, controller, mounting — commonly runs a few thousand to low tens of thousands depending on speed and precision. Integration, software, validation, and line modification usually exceed the hardware cost. The line modification is often the longest-lead item.
Do we need 3D vision?
Only if the defect or measurement is genuinely geometric — warp, flatness, volume, surface deformation. 3D adds cost and cycle time. Many defects assumed to need 3D are detectable in 2D with the right lighting geometry, which is worth testing first.
How do we validate an inspection system?
Run a gauge study against known-good and known-defective parts, measuring both escape rate and false-reject rate, with parts spanning the full range of acceptable variation. In regulated environments this becomes a formal validation with documented acceptance criteria. Establish the baseline before deployment so drift is detectable afterwards.
