Contact Try it now

← Back to blog

Automated inspectionReading time 12 min

Machine Vision Starts With the Image, Not the Algorithm

If a defect barely appears in the image, software cannot reliably find it. Lighting, optics and part presentation determine the signal the algorithm receives. Fix the image first.

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

01Start with resolution

Before choosing an algorithm, check whether the defect occupies enough pixels to be measured. The field of view divided by the sensor's horizontal pixel count gives an approximate size per pixel. Use that figure to set the optics and camera, then test whether the lighting gives reliable contrast.

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
Check resolution against the smallest defect before selecting software.

02Design the lighting

Lighting changes the image before any algorithm sees it. Choose the angle, color and diffusion so the target feature stands apart from the background while normal variation stays as even as possible.

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
Backlighting and low-angle lighting can create useful contrast for different defect types.

Wavelength is a variable too

Light color and wavelength are tools, not universal rules. Red, blue, infrared and ultraviolet illumination each interact differently with materials and coatings. Test the actual defect and part under candidate lighting before locking the design.

03Typical 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.

Begin with a simple, measurable task such as presence detection. Once optics, fixturing, triggering and data handling are stable, move to more variable appearance judgments. This order makes failures easier to diagnose.

04Questions before deployment

  • 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.