Perception and Sensors
The Lighting Mistakes That Kill Machine Vision Projects
Most vision failures are lighting failures. Six mistakes account for the majority, and every one of them costs less to fix at design time than after installation.

Lighting decides whether a vision project works, and it is chosen last in most projects. Six mistakes account for the majority of failures: using ambient light, ignoring sunlight, wrong geometry, no wavelength control, no shielding, and testing on clean parts. Each costs hours to fix during design and weeks after installation.
The six mistakes
- Relying on ambient light. Factory illumination changes with the time of day, the season, which lamps are working and whether the door is open. A vision system calibrated in the afternoon fails in the morning.
- Ignoring sunlight. Direct sunlight is around 100,000 lux against 300 to 500 lux of typical indoor lighting, so a station near a loading door faces a two hundredfold change during a shift. Structured light and time-of-flight sensors are particularly vulnerable.
- Wrong geometry. Front lighting a shiny part produces glare; backlighting the same part produces a perfect silhouette. Geometry changes contrast by a factor of ten to forty, far more than any algorithm.
- No wavelength control. Monochromatic illumination with a matched bandpass filter rejects ambient light of other wavelengths, which is the single most effective defence against changing surroundings.
- No shielding. An enclosure or a shroud costs a few hundred and removes the entire problem class. It is routinely cut from the budget and routinely added later at greater cost.
- Testing on clean parts. Oil, coolant, chips, fingerprints and release agent all change how a surface returns light. A system validated on cleaned samples meets different parts in production.
The four geometries
| Geometry | Reveals | Hides | Use |
|---|---|---|---|
| Backlight | Outline, holes, gaps | All surface detail | Dimensional measurement, presence |
| Diffuse dome | Print, colour, markings on shiny parts | Surface texture and dents | Reading codes on curved metal |
| Directional or bar light | Texture, scratches, embossing | Even features on flat surfaces | Surface defect inspection |
| Dark field, low angle | Edges, scratches, engraved marks | Flat uniform areas | Etched code reading, crack detection |
| Coaxial | Flat specular surfaces | Anything at an angle | Mirror-finish inspection |
The choice is dictated by the feature, not by the part. Reading an etched code and detecting a scratch on the same component need different lights, and a station required to do both usually needs two, switched in software.
Wavelength and filtering
| Band | Wavelength | Good for | Note |
|---|---|---|---|
| Blue | 450 to 470 nm | Fine detail, red or dark parts | Shortest wavelength, best resolution |
| Green | 520 to 530 nm | General purpose, red features | Peak sensor sensitivity on many sensors |
| Red | 620 to 660 nm | General purpose, efficient | Cheapest, high output |
| Near infrared | 850 to 940 nm | Rejecting ambient light, seeing through some plastics | Invisible to operators, needs a warning label |
| Ultraviolet | 365 to 405 nm | Fluorescent marking, adhesive detection | Safety precautions required |
Pairing a narrowband source with a matched bandpass filter on the lens is the standard defence against ambient variation. It typically rejects the great majority of light outside the passband, which turns a station affected by daylight into one that is not.
Specifying a lighting solution
| Item | Example | Why |
|---|---|---|
| Feature to be detected | 0.3 mm scratch on brushed steel | Dictates geometry and wavelength |
| Required contrast | at least 40 grey levels | Makes the result measurable |
| Working distance | 220 mm | Determines light size and intensity |
| Ambient conditions | up to 20,000 lux at the station | Sets shielding and filter requirements |
| Part surface states | Oiled, chipped, freshly machined | The real test set, not clean samples |
| Exposure and strobe | 200 us at 25 Hz | Freezes motion, reduces ambient share |
| Maintenance access | Cleanable without tools | A dusty light is a slow failure |
Strobing deserves a note of its own. A short exposure with a bright pulse both freezes part motion and reduces the ambient contribution, because ambient light integrates over the exposure while the pulse does not. Dropping exposure from 5 ms to 200 microseconds cuts the ambient share by a factor of 25 for free.
Frequently asked questions
Why do machine vision projects fail on lighting?
Because lighting decides contrast and contrast decides whether the algorithm is simple or fragile. Ambient light varies with time of day, season and open doors, so any system depending on it fails intermittently.
How much does sunlight matter?
A great deal. Direct sunlight is roughly 100,000 lux against 300 to 500 lux of typical indoor lighting, a two hundredfold change. Stations near loading doors need shielding, narrowband illumination and matched filters.
Which lighting geometry should I use?
Backlight for outlines and dimensions, diffuse dome for markings on shiny curved parts, directional for texture and scratches, dark field for etched marks and cracks. The feature dictates the geometry, not the part.
Does the wavelength matter?
Yes. A narrowband source with a matched bandpass filter rejects ambient light of other wavelengths, which is the most effective single defence against changing surroundings. Blue gives the finest detail, near infrared the best ambient rejection.
Can software compensate for bad lighting?
Only partly, and at a cost. Recovering a feature from a poor image needs a complex, slow and fragile algorithm, whereas correct lighting produces an image a simple robust method handles. Fix contrast optically first.
Sources
- Robotics at NISTNational Institute of Standards and Technology, robot performance measurement and test methods
- IEC 60529, degrees of protection provided by enclosuresInternational Electrotechnical Commission, relevant to lighting enclosures in wet or dusty cells
- ISO 10218-1:2025, Robotics, Safety requirements, Part 1International Organization for Standardization, requirements for vision used in safety functions