
- What is machine vision quality inspection
- Visual map of machine vision inspection
- How it works: camera, lighting, algorithm and decision
- Classic rules or deep learning
- How much resolution the camera needs
- Example: bottle caps, 10,000 per day
- How to validate before trusting it
- Common mistakes and limitations
- Frequently asked questions
What is machine vision quality inspection
Machine vision quality inspection uses cameras, lighting and an algorithm to examine every part on the line and decide in a fraction of a second whether it conforms. It checks component presence, dimensions, position, color, code reading and surface defects.
Inspecting is not preventing. Vision detects a defect after it exists, so it works best alongside poka-yoke, which prevents the error, and jidoka, which stops the line when a defect appears.
Visual map of machine vision inspection
The map summarizes the chain of camera, lighting, algorithm and decision, with the numbers from this article's example.

How it works: camera, lighting, algorithm and decision
- Camera and lens: set the field of view and the pixel size on the part.
- Lighting: makes the defect visible. It usually matters more than the camera. Ring, backlight, low-angle and dome lights suit different defects.
- Algorithm: classic rules (thresholding, edges, measurement, template matching) or neural networks (deep learning) trained on images.
- Decision: pass, reject or stop the line, sending the signal to the PLC and saving the image for traceability.
When the image is poor, no algorithm saves the result. Fix the lighting and part fixturing first.
Classic rules or deep learning
| Criterion | Classic rules | Deep learning |
|---|---|---|
| Best for | Measuring, counting, reading codes, presence checks | Variable defects (scratches, stains, texture) |
| Images needed to start | Few | Tens to hundreds of examples per class |
| Explaining the result | Clear: measured value against tolerance | Harder to audit |
| Sensitive to lighting changes | Very | Less, if trained with variation |
Use the simplest rule that solves the problem. Dimensions and presence almost never need AI.
How much resolution the camera needs
Rule of thumb: the smallest defect should cover at least 3 pixels in each direction.
Pixel (mm) = smallest defect ÷ 3 | Pixels across the field = field of view ÷ pixel
| Item | Calculation | Result |
|---|---|---|
| Smallest defect | given | 0.3 mm |
| Required pixel size | 0.3 ÷ 3 | 0.1 mm |
| Field of view | given | 80 mm |
| Minimum pixels across | 80 ÷ 0.1 | 800 |
| Chosen camera | 1,280 × 960 pixels | 0.0625 mm/pixel |
| Pixels on the smallest defect | 0.3 ÷ 0.0625 | 4.8 |
A camera 1,280 pixels wide meets the need with margin. More resolution only adds processing time.
Example: bottle caps, 10,000 per day
Fictional example. The line makes 10,000 parts a day, 0.5% of them defective (50 parts). The vision system was tested with two decision thresholds.
| Result | Threshold A | Threshold B (stricter) |
|---|---|---|
| Defects detected (of 50) | 46 (92%) | 49 (98%) |
| Defects that escape | 4 | 1 |
| Good parts rejected (of 9,950) | 120 (1.21%) | 400 (4.02%) |
| Total rejected | 166 | 449 |
| Rejects that were truly defective | 46 ÷ 166 = 27.7% | 49 ÷ 449 = 10.9% |
Costs: a defective part reaching the customer, $250; a good part rejected, $3.
Cost A = 4 × 250 + 120 × 3 = $1,360 | Cost B = 1 × 250 + 400 × 3 = $1,450
The stricter threshold catches more defects but costs more because of false rejects. The best threshold is the one that minimizes total cost, not the one that maximizes detection. With rare defects, most rejects will be good parts (72.3% at threshold A). That is normal and the re-inspection process must plan for it.
How to validate before trusting it
- Gather good parts, defective parts and borderline parts, classified by trained people who agree.
- Test the system against that set and compute detection and false-reject rates. The logic is that of an attribute measurement system analysis.
- Include real variation: shifts, raw material lots, a dirty lens and an aging lamp.
- Run in parallel with the inspector before release. Record it in the control plan and repeat the check with master parts at a defined frequency.
- Track the reject rate on a control chart (SPC) and the first pass yield (FPY).
If sampling inspection was the previous method, compare it with AQL sampling: vision inspects 100% of parts, but only for the aspects the camera can see.
Common mistakes and limitations
- Lighting ignored: glare and shadows cause more error than the algorithm.
- Too few defects to train on: the model does not learn what it has never seen. Rare defects call for synthetic images or anomaly detection.
- Product, color or supplier change: the system must be revalidated.
- Drift: a dirty lens and a worn lamp degrade the image without warning.
- Hidden failure: the camera cannot see what is outside its view, such as internal dimensions and material properties.
- Treating inspection as the fix: the cause of the defect is still in the process.
Frequently asked questions
What is machine vision used for in quality inspection?
To check 100% of parts on the line for presence, position, dimension, color, code and surface defects, with an automatic decision.
Does machine vision replace the inspector?
For repetitive, well-defined tasks, yes. Doubtful cases, validation and root cause analysis stay with people.
Do I need artificial intelligence?
Not always. Measuring, counting and code reading work with classic rules. Deep learning helps with variable surface defects.
What is the minimum camera resolution?
The smallest defect should cover at least 3 pixels. With a 0.3 mm defect and an 80 mm field, 800 pixels across is enough.
What is a false reject?
A good part that the system rejects. In the example, 120 of 9,950 good parts, or 1.21%.
How do I choose the decision threshold?
Compare the cost of an escaping defect with the cost of a false reject, as in the example: $1,360 at threshold A against $1,450 at B.
Sources
- STEGER, C.; ULRICH, M.; WIEDEMANN, C. Machine Vision Algorithms and Applications. Weinheim: Wiley-VCH.
- DAVIES, E. R. Machine Vision: Theory, Algorithms, Practicalities. Academic Press.
- SHINGO, S. Zero Quality Control: Source Inspection and the Poka-yoke System. Productivity Press, 1986.
- AIAG. Measurement Systems Analysis (MSA) Reference Manual.
Keep studying: trusted sources and links
Save this address: Manufatura Enxuta is your school for lean manufacturing. Come back whenever you need to study, with a complete article, a visual map and trusted sources. Follow one of the learning paths or check the A–Z glossary.
Want a quick reference guide for the factory floor?
Download the free Pocket Guide e-book with the Lean tools summarized on one page each.
Download the e-book
