Industrial camera with ring lighting inspecting bottle caps moving on a conveyor in a production line

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.

MACHINE VISION INSPECTION
Visual map 229: Machine vision quality inspection: uses and limits. Click the map to see it full size.Download the map as PNG
Advertisement

How it works: camera, lighting, algorithm and decision

  1. Camera and lens: set the field of view and the pixel size on the part.
  2. Lighting: makes the defect visible. It usually matters more than the camera. Ring, backlight, low-angle and dome lights suit different defects.
  3. Algorithm: classic rules (thresholding, edges, measurement, template matching) or neural networks (deep learning) trained on images.
  4. 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

CriterionClassic rulesDeep learning
Best forMeasuring, counting, reading codes, presence checksVariable defects (scratches, stains, texture)
Images needed to startFewTens to hundreds of examples per class
Explaining the resultClear: measured value against toleranceHarder to audit
Sensitive to lighting changesVeryLess, 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

ItemCalculationResult
Smallest defectgiven0.3 mm
Required pixel size0.3 ÷ 30.1 mm
Field of viewgiven80 mm
Minimum pixels across80 ÷ 0.1800
Chosen camera1,280 × 960 pixels0.0625 mm/pixel
Pixels on the smallest defect0.3 ÷ 0.06254.8

A camera 1,280 pixels wide meets the need with margin. More resolution only adds processing time.

Advertisement

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.

ResultThreshold AThreshold B (stricter)
Defects detected (of 50)46 (92%)49 (98%)
Defects that escape41
Good parts rejected (of 9,950)120 (1.21%)400 (4.02%)
Total rejected166449
Rejects that were truly defective46 ÷ 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

  1. Gather good parts, defective parts and borderline parts, classified by trained people who agree.
  2. Test the system against that set and compute detection and false-reject rates. The logic is that of an attribute measurement system analysis.
  3. Include real variation: shifts, raw material lots, a dirty lens and an aging lamp.
  4. 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.
  5. 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

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.

Advertisement

Sources

  1. STEGER, C.; ULRICH, M.; WIEDEMANN, C. Machine Vision Algorithms and Applications. Weinheim: Wiley-VCH.
  2. DAVIES, E. R. Machine Vision: Theory, Algorithms, Practicalities. Academic Press.
  3. SHINGO, S. Zero Quality Control: Source Inspection and the Poka-yoke System. Productivity Press, 1986.
  4. 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
Photo of Vagner Soares

About the author

Vagner Soares

Lean Manufacturing & Behavioral Management Specialist

Over 20 years in the automotive and metalworking industries (GM and Dana), Lean Manufacturing practitioner since 2006. SENAI instructor and mentor in Brazil’s Brasil Mais Produtivo program, delivering consulting, training and audits for 50+ companies, combining quality, productivity and people development.