When a machine vision system performs badly, the camera and the software get the blame, but the actual culprit is usually machine vision lighting. Lighting creates the contrast between defect and background; the camera merely records it and the software merely measures it. No algorithm, classical or deep learning, can recover contrast that the illumination never produced. Veteran integrators like to say that a vision application is 80 percent solved once the lighting is right, and the number is only slightly exaggerated.
This post covers the core lighting geometries, how to match them to inspection tasks, and how to run a lighting study before you spend real money.
Why lighting matters more than the camera
An image is not a picture of a part. It is a picture of how light left the part and entered the lens. Change the light and you change the image completely, on the same part, with the same camera.
Consider a shallow scratch on machined aluminum. Under diffuse overhead light, the scratch reflects nearly the same intensity as the surrounding surface and disappears into the noise. Move a bar light down to a ten-degree grazing angle and the scratch lights up like a filament against a dark field. Nothing about the camera changed. The defect went from statistically invisible to trivially detectable because the geometry changed which surfaces redirect light into the lens.
This is why buying more megapixels rarely rescues a struggling inspection. Twelve megapixels of two-gray-level contrast is still two gray levels. Spend the effort where the contrast is made.
The four core machine vision lighting geometries
Almost every practical setup is one of four geometries, or a combination.
Bright field is direct illumination from roughly the camera's side, the closest thing to ordinary light. Flat surfaces reflect it back into the lens and appear bright; features that scatter light appear darker. It is the default for general-purpose inspection, label checks, and printed features. On shiny parts it creates hotspots, which is where the other geometries come in.
Dark field puts light in at a low grazing angle, typically 10 to 30 degrees from the surface. A flat, smooth surface reflects that light away from the lens and images nearly black. Anything that sticks up or digs in, such as scratches, dents, embossing, engraved characters, or edge chips, scatters light upward and glows against the dark background. Dark field is the standard answer for surface flaw detection on smooth parts.
Backlight puts the part between a diffuse panel and the camera, producing a silhouette. Edges become razor-sharp black-on-white transitions, which is why backlighting paired with a telecentric lens is the geometry of choice for dimensional gauging, thread inspection, and presence checks through translucent containers. If the feature you care about lives on the outline, backlight it.
Dome (diffuse) lighting surrounds the part with soft, even light from all directions, sometimes called cloudy-day illumination. It erases glare and specular hotspots, which makes it the workhorse for curved shiny surfaces: beverage cans, foil lids, blister packs, chrome parts. A close cousin, coaxial illumination, sends light through a beamsplitter straight down the lens axis, and excels on flat specular surfaces such as polished metal, wafers, and glass, where it makes flatness bright and any tilt or defect dark.
Choosing among them starts with two questions. Is the feature topographic (raised or recessed) or tonal (a color or reflectance difference)? And is the surface matte or specular? Topographic features on smooth surfaces want dark field. Outline features want backlight. Specular curved surfaces want a dome. Tonal features on matte surfaces are usually happy in bright field. That small decision table resolves most applications before any hardware is ordered.
Which wavelength and filters should you use?
Monochrome cameras plus colored light is the standard recipe, because color contrast can be manufactured with wavelength choice. Red LEDs around 630 to 660 nm are the default: inexpensive, efficient, and near the sensitivity peak of common CMOS sensors. Blue light around 470 nm scatters more from fine surface texture and often improves contrast on machined metal, and it darkens rust and oxidation. A red feature under blue light images dark; under red light it images bright. If you need to make a printed red date code vanish so you can inspect the surface beneath it, light it red.
Beyond the visible, infrared around 850 nm passes through many dyed plastics and suppresses printed graphics, letting you inspect fill levels or contents through packaging. Ultraviolet excites fluorescence in many adhesives, coatings, and inks, turning an invisible conformal coating check into a bright-glow presence check.
Two filters earn permanent space in the toolkit. A polarizer pair, one on the light and one crossed on the lens, kills specular glare from glass, liquid, and glossy plastic. And a bandpass filter matched to your LED wavelength blocks most ambient light before it reaches the sensor, cheap insurance for any system that cannot be fully enclosed.
Strobing, triggering, and the ambient light problem
Production parts move, and motion during exposure smears the image. The arithmetic is unforgiving: a part traveling 200 mm/s imaged with a 1 ms exposure blurs across 200 microns, which erases any defect near that scale. The fix is short exposures with intense pulsed light. LED strobe controllers overdrive lights to several times rated current for pulses of tens of microseconds, safely, because the duty cycle stays low. That same part at a 50 microsecond exposure blurs only 10 microns.
Strobing has to be synchronized, which is what hardware triggering is for. A photoeye or encoder fires the camera and the strobe together at the exact part position every cycle, so every image is geometrically identical. Free-running cameras with software triggers are for lab benches, not lines.
Then there is ambient light, the silent killer of deployed systems. A system tuned in October fails in March because afternoon sun now reaches the fixture through a far window. Overhead bay lights get relamped from fluorescent to LED and every gray level shifts. The reliable fix is physical: shroud the inspection station and overpower what leaks in with your strobe. Fighting ambient light in software is a losing position, and it is one of the classic vision project failure modes.
How to run a lighting study
Before committing to hardware, spend a disciplined day or two at the bench. Gather real production parts, including the ugliest confirmed defects you have and, just as important, cosmetically varied good parts. Then work the geometries methodically: bright field, dark field at a couple of angles, backlight if the feature touches the outline, dome or coaxial if the surface is shiny, in a couple of wavelengths, with and without polarization.
Judge the results with numbers, not squinting. Measure the gray-level separation between defect and background, and check it across all your samples, because a technique that produces beautiful contrast on one scratch and nothing on the next is a trap. As a working target, look for the defect to sit at least 20 to 30 gray levels away from its background with healthy margin over the noise. Save every image with notes on geometry, working distance, and settings; that archive becomes the seed of your test library, and if the application later goes deep learning, your first training data.
If no geometry produces repeatable contrast, that is not failure. That is a two-day study saving you from a six-figure system that could never have worked, and it redirects the conversation toward different sensing, different optics, or a different inspection point.
FAQ
Why do most machine vision inspections fail because of lighting?
Because software can only measure contrast that already exists in the image, and contrast is created almost entirely by illumination geometry, wavelength, and surface interaction. Systems designed camera-first, with lighting as an afterthought, ship with marginal contrast and then oscillate between escapes and false rejects on the line.
What is the difference between bright field and dark field lighting?
Bright field lights the part from near the camera axis, so smooth surfaces image bright and scattering features dark. Dark field lights the part at a grazing angle, so smooth surfaces image dark and raised or recessed features glow bright. Dark field is the usual choice for finding scratches, dents, and engraved marks on smooth parts.
Do I need a strobe light for parts moving on a conveyor?
Almost always, yes. Motion blur equals part speed multiplied by exposure time, so anything beyond slow indexing needs exposures in the tens-of-microseconds range, which requires overdriven pulsed LEDs synchronized to a hardware trigger. Continuous lighting on a moving line usually means smeared images or an exposure so long that ambient light pollutes it.
Can deep learning compensate for bad lighting?
Only partially, and it is an expensive way to buy tolerance. A network handles moderate scene variation better than rule-based tools, but a defect with no optical contrast is invisible to any algorithm. Good lighting also shrinks the training set a network needs, because the model no longer has to learn around illumination noise.
If an inspection on your line keeps misbehaving, the odds are good that a lighting study, not a software rewrite, is the fix. Willowark designs vision and sensing systems with optics and illumination engineered first, and we are glad to look at your parts and tell you what the light can and cannot do. Contact us to start that conversation.
Relevant for Food & Beverage, Manufacturing, Packaging · Vision & Advanced Sensing
Engineering notes, monthly
One article like this a month. No pitch.
What we're building across the digital/physical boundary, what we learned, and one thing you can use. Double opt-in, one-click unsubscribe.

