Free Trial

← Back to blog

Automated inspectionReading time 12 min

Whether machine vision can see it is half decided by the lighting

When a vision system will not work, engineers usually blame the algorithm first. The real cause is normally further upstream: in the image, the defect simply is not obvious.

Wikimedia Commons・Robotic Arm Polishing Guitars at Martin Guitar・CC BY 4.0

01Calculate first, then talk about seeing

The first design step for a vision system is resolution. The formula is simple: real size per pixel = field of view width ÷ horizontal sensor pixels.

ItemExampleWhat it asks
Field of view50 mmThe area you need to see
Sensor2448 × 2048 (5 megapixel)Camera specification
Spatial resolution50 ÷ 2448 ≈ 0.020 mm/pxHow much one pixel covers
Detectable defectAbout 0.06 to 0.1 mmUsually needs 3 to 5 pixels to be reliable
Measurement accuracyAbout 0.005 to 0.01 mmSub-pixel algorithms reach 1/4 to 1/2 pixel
Work this table out first. If the numbers say you cannot see the target defect, changing algorithm will not help.

02Lighting decides everything

The same part under different lighting can produce completely different images. The principle is simple: make the feature you are looking for brighter or darker, and keep everything else uniform.

TechniqueArrangementGood at finding
BacklightSource behind the partOutline, through holes, missing parts
CoaxialLight through a beam splitter, on the lens axisScratches on mirror surfaces, printed characters
Ring light (high angle)Angled down from around the lensSurface texture, general appearance
Low-angle ring lightAlmost parallel to the surfaceEngraving, relief, edge chips
Diffuse domeDiffuse reflection off a hemisphereEven lighting on curved or shiny parts
Structured lightProjected fringes or a line laserThree-dimensional height, flatness, volume
Backlight and low-angle light are the two most underrated, they turn algorithm problems into threshold problems.

Wavelength is a variable too

Red penetrates further but gives poor contrast on red features. Blue is shorter and scatters less, suiting fine features and precise measurement. Infrared passes through some plastics and shows what is inside. Ultraviolet excites fluorescence, useful for checking adhesive volume and coating coverage.

03Four common applications

  1. Presence and absence. Is the part there, is it the right way round. The simplest, most stable and highest-return application.
  2. Dimensional measurement. Outline, hole diameter, spacing. Needs accurate lens calibration and a repeatably positioned part.
  3. Appearance inspection. Scratches, dents, contamination, colour variation. The hardest, because defects vary so much in form.
  4. Character and code reading. OCR, barcodes, DataMatrix. Mature technology; lighting and contrast are what matter.

Roll them out in that order. Start with presence and absence, get the optics, mechanics, triggering and data flow running smoothly, then move towards appearance inspection. Doing it the other way round usually stalls at the first hurdle and gets abandoned.

04Three questions to ask first

  • Can you write down the definition of the defect? If your own experienced inspectors do not agree with each other, no system will be consistent either. Run a repeatability study on human judgement first, much like GR&R.
  • Can you control how the part sits? Nothing hurts a vision system more than variable position and attitude. Most failed projects fail on mechanics, not software.
  • What does each kind of error cost? The cost of a miss and the cost of an over-reject are usually not symmetric, and the threshold should lean towards whichever is cheaper.