◇ Machine vision · Guide

Machine vision lighting, explained with diagrams.

The camera records contrast. The light creates it. Before you compare sensors or argue about deep learning, get the geometry right: where the light comes from, where its reflection goes, and what the feature you care about does to it. This guide draws every common lighting setup and shows when each one wins.

8lighting geometries drawn as ray diagrams
θᵢ = θᵣthe reflection law behind every choice
5 × 4surface-by-feature selection matrix
In short

Decide what the feature does to light, then put the light where that difference is largest. Flat shiny parts want coaxial or bright field. Scratches, embossing and edges want low-angle dark field. Curved shiny parts want a dome. Outlines and holes want a backlight, made telecentric when you're gauging.

Then tune the spectrum and the timing. Use a monochrome camera with one wavelength chosen for contrast, a polarizer pair if glossy non-metal glare is the problem, and a strobe with a short exposure and a bandpass filter so ambient light stops mattering. Lighting is cheap next to the cost of a station that rejects good parts.

The reflection rule

Bright field and dark field come from one law.

On a shiny surface, light leaves at the same angle it arrived, mirrored about the surface normal. Put the camera where that reflection lands and the surface glows. Put it anywhere else and the surface goes black. Everything else in this guide is a variation on that sentence.

Fig. 01Same scratch, same camera, two light positions
Bright field θᵢθᵣ scatter light Camera seesscratch dark polished flat surfaceMirror reflection lands in the lens: bright background.The scratch scatters light away, so it shows dark. Dark field scatter to lens low-angle light Camera seesscratch bright same surface, same scratchMirror reflection leaves at a low angle: dark background.Scratch edges scatter light up, so it shows bright.
Move the light, invert the image. Bright field puts the light inside the cone of angles that reflect into the lens; dark field puts it outside. On matte surfaces the difference shrinks because they scatter light in all directions, which is why lighting choice starts with how shiny the surface is.

We've walked onto a lot of lines where an inspection "almost works" and someone has spent weeks tuning thresholds. More often than not the image is the problem: the defect is three gray levels darker than the background and a reflection beside it is ten levels brighter. No setting fixes that. A different light does, often in an afternoon.

So every station starts with two questions. What is the surface: matte, shiny and flat, shiny and curved, transparent, or textured? And what does the feature do to light that the surface doesn't? A scratch changes the angle light leaves at, print changes how much is absorbed, a hole lets it through. Each is best revealed by a different geometry.

Ring lights

Ring lights, high and low.

The same donut of LEDs behaves completely differently depending on its height above the part. Mounted at the lens it's a general-purpose front light. Lowered to the part, it becomes the most useful dark field tool there is.

Fig. 02aRing light at the lens
ring light Camera seesLOT 0427EXP 2027-03print dark, even matte part with printLight from close to the lens axis, all around.Even on matte parts; ring-shaped glints on shiny ones.
The default front light, and often the wrong one. Great for print, labels, colored parts and presence checks on matte surfaces. On anything shiny it paints a bright ring reflection right where you were hoping to inspect.
Fig. 02bLow-angle ring · dark field
marks scatter up low-angle ring Camera seesLOT 0427LOT 0427EXP 2027-03marks bright mirror-finish part, engraved markLight grazes the surface at a low angle.Flat areas go dark; edges and marks light up.
The scratch and emboss finder. Anything that breaks the flat surface (a scratch, a burr, a dot-peen dot, raised text) throws light upward and shows bright on black. Working distance is short: the ring has to sit within a few centimeters of the part.

Ring light at the lens

A ring around the lens lights the part from nearly the camera's direction: even light and few shadows on matte, colored or printed surfaces. It's the usual start for assembly verification (is the clip there, is the connector seated) and for reading labels in OCR and code reading. On polished parts you get a crisp image of the ring instead of the part.

Low-angle ring (dark field)

Drop the ring to just above the part and the light skims the surface. Flat areas reflect it to the far side and go dark; scratches, burrs, embossed text and edges face the light and scatter some straight up. We use it on surface defect inspection of machined faces, on dot-peened codes, and on burr and edge inspection after deburring, where a leftover burr is exactly what dark field exaggerates.

Directional and diffuse

Bar lights cast shadows. Domes erase them.

These two sit at opposite ends of a scale. A bar light comes from one direction and turns height into shading. A dome comes from every direction and makes shape disappear, which is exactly what you want when shape is the noise.

Fig. 03aBar lights at an angle
bar light flank glint Camera seesbead break plate with sealant beadDirectional light from one or both sides.Shading shows shape; long bars cover long parts.
Cheap, flexible, and easy to get wrong. Bar lights cover long fields (a sealant bead along a flange, a row of parts on a belt) and can be aimed. Angle and distance change the image a lot, so lock both mechanically once the image is right.
Fig. 03bDome · cloudy-day light
dome camera hole Camera seesdent shows, no glints curved, shiny partDiffuse light from every direction: no glints, no shadows.Must sit close; the camera hole can show on mirror parts.
The fix for curved shiny parts. A dome gives every point on a ball bearing, chrome fitting or crinkled foil pack the same light from all directions, so specular hot spots disappear and real defects stand out. It flattens shallow texture too, so it can hide the very scratch dark field would find.

Bar lights

A bar light is a strip of LEDs aimed wherever the job needs: low for linear dark field, steep for bright field on a long part, or paired to shade both flanks of a bead. We use bars on bead and dispense inspection along flanges and on wide fixtures in weld inspection.

Fire four directional lights in sequence and the brightness change between images gives surface slope at each pixel (photometric stereo, or shape from shading), which pulls shallow dents and embossed text out of a busy surface.

Domes and other diffuse lights

A dome bounces LED light off a white inner surface so it reaches the part from the whole hemisphere: like an overcast sky, no hard shadows or glints. It's the go-to for surface inspection of curved shiny parts, for wrinkled labels and blister packs, and for reading codes on curved shafts.

It must sit close, and mirror-like parts reflect the dark camera hole back. Coaxial-diffuse designs fill that hole with on-axis light through a beam splitter.

On-axis and structured

Coaxial light for mirrors, structured light for height.

Fig. 04aCoaxial · on-axis light
etch goes dark LED beam splitter Camera seesetch dark on bright flat, mirror-finish partLight arrives along the lens axis via a beam splitter.Flat mirror faces bright; etch, scratches and tilt go dark.
The purest bright field there is. Because the light and the view share one axis, a flat reflective surface returns light straight into the lens and anything off-flat goes dark. The beam splitter costs light (a 50/50 splitter loses half on the way down and half again on the way back), so coaxial lights need short working distances or strong LEDs.
Fig. 04bStructured light · laser line
θ Δz Δx = Δz · tan θ laser Camera seesline jumps with height raised feature on a base plateThe line shifts sideways in proportion to height.Profiles beads, gaps and warp; needs motion to cover area.
Lighting that measures instead of illuminates. A laser line or projected fringe pattern turns height into lateral position. At θ = 45°, 1 mm of height moves the line 1 mm sideways. This is the same triangulation behind most industrial 3D cameras.

Coaxial light

A coaxial light turns its LED's output 90° with a partial mirror so it travels down the camera's own axis. A flat specular surface (machined face, wafer, glass) returns it uniformly bright; anything that tilts the surface slightly, such as a scratch, etched character or dent, sends it off-axis and reads dark.

It's the first thing to try for laser-etched Data Matrix codes on flat faces in code reading, and for flat polished parts in surface inspection. On a cylinder it lights only a thin line.

Structured light

Structured light projects a known pattern (a laser line, dots, a stripe sequence) and reads geometry from how it deforms. A laser profiler measures one cross-section per frame, so something has to move; area fringe projectors capture a whole surface from a static position.

We use laser profiles for bead height and width in dispense inspection, for weld toe and undercut in weld inspection, and area structured light for vision-guided bin picking. Shiny parts are hard: the line can reflect away or appear twice.

Backlights

Backlights turn parts into silhouettes.

If the feature you care about is an outline, a hole or a gap, stop lighting the part and light what's behind it. Surface finish, color and glare stop mattering. Only the edge is left.

Fig. 05aDiffuse backlight
backlight Camera seesblack on white opaque part on a diffuse backlightPart blocks the light: a dark silhouette on white.Edges, holes, gaps and outlines; no surface detail.
The highest-contrast image you can make. Black part, white background, no tuning. A diffuse backlight lets light leave at many angles, so a thick part's side walls can glow and soften the edge by a pixel or two.
Fig. 05bTelecentric (collimated) backlight
telecentric lens Camera seescrisp, true-size edges thick part on a collimated backlightParallel rays, parallel acceptance: no side-wall glow.Edge position holds as the part moves in depth.
The gauging setup. Collimated light paired with a telecentric lens means only rays parallel to the axis form the image, so side walls don't reflect into the edge and magnification doesn't change with distance. The cost is size: the lens front element must be at least as large as the field.

A backlight is the tool when the question is geometric and the part opaque: diameters, hole positions, thread profiles, flash on a molded edge. It's the core of dimensional gauging, and the simplest way to locate flat parts for robot picking.

On a thick part, angled light from a diffuse panel grazes the side wall into the lens, the edge blooms inward, and the diameter reads small by a pixel or so. A conventional lens also sees near and far edges at different magnifications. A telecentric lens with collimated light fixes both, which is why precision pin gauging uses that pair.

Field note

Clear parts nearly vanish on a diffuse backlight. Under collimated light, edges and scratches bend rays out of the lens's acceptance and show as dark lines, and crossed polarizers either side of a clear molding reveal stress around gates. Try collimated light before giving up on a backlight.

# Why a pixel of edge bloom matters in gauging field 60 mm across, sensor 2,448 px wide 60 / 2,448 = 0.0245 mm/px # bloom of 1 px on each side of a pin 2 × 0.0245 ≈ 0.05 mm undersize # against a ±0.025 mm diameter tolerance bias = twice the tolerance half-width
Color and wavelength

Pick the color of the light, not the camera.

Geometry decides where light goes. Wavelength decides what the material does with it. For most inspections, a monochrome camera and one well-chosen LED color beat a color camera under white light, on both contrast and resolution.

Fig. 06aHue circle and complementary colors
Hue circle Red Yellow Green Cyan Blue Magenta opposite Same color as the part: part bright. Opposite color on the circle: part dark.
Opposites darken, matches brighten. A red feature reflects red and absorbs cyan, green and blue. Light it red and it glows; light it with the color across the circle and it goes nearly black. You choose which way to push the contrast.
Fig. 06bOne part, three lights, monochrome camera
Red sticker on a green board In color White light Red light Green light contrast low contrast both mid-gray sticker bright board dark sticker dark board bright Color sensor1 pixel in 4 sees red Mono + red LEDevery pixel sees it A color camera splits its pixels across filters; a mono camera with one wavelength uses all of them.
Contrast is a choice you make with an LED. Schematic gray levels, not measured images. Under white light a mono camera sees red and green at similar brightness. A single colored light separates them strongly, in whichever direction the inspection prefers.
Fig. 07Common LED wavelengths and what each is good for
Common LED wavelengths for machine vision invisible to the eye silicon sensor response 365 470 525 625 850 940 nm UV Visible Near infrared UV: fluorescence glue, grease, coatings glow block the UV at the lens Blue: surface detail scatters most at the surface fine scratches, laser etch Red: the workhorse less scatter, bright, cheap darkens blue, green features NIR 850/940: through dyes hides print and color variation pairs with a pass filter
Shorter wavelengths see the surface; longer ones see into and through it. Band edges are approximate. Silicon sensors lose sensitivity toward 940 nm, so the same exposure needs more light there than at 850 nm. Check the camera's spectral response curve before choosing.

Why monochrome usually wins

A color camera's Bayer filter makes half its pixels green and a quarter each red and blue, interpolating the rest. If the job is a red feature against its background, red detail is sampled by a quarter of the pixels. A monochrome camera under red light uses every pixel, and with no filter in the way collects more light per pixel.

Color cameras earn their place when the job is color: sorting wire colors in a cable assembly, matching caps to bottles. Otherwise, light with the color that makes the difference largest.

Blue, red, IR and UV

Blue scatters more from fine surface structure, so shallow scratches and laser etch on metal stand out. Red scatters less, penetrates further and is the cheap, bright default. Near infrared passes through many dyes and inks, sees through some colored plastics and hides batch color variation; with an IR pass filter it also rejects visible ambient light.

UV is a different trick. Many adhesives, greases and coatings fluoresce under 365 or 395 nm light; a long-pass filter on the lens blocks the UV and leaves a glowing bead on a dark part. It's one of the best checks for clear adhesive in dispense inspection, if the material fluoresces (ask the supplier, or try a UV flashlight). Follow the vendor's eye-safety guidance with UV.

Polarizers

Cross-polarization kills glare, and costs light.

When glare comes off a glossy non-metal surface (shrink film, a coated label, a molded part, a conformal-coated board), two cheap filters can remove most of it without changing the light geometry.

Fig. 08Glare with and without crossed polarizers
Without polarizers glare light Camera seesprint hidden glossy printed labelSpecular glare lands in the lens and hides the print.Mirror reflection keeps the light’s polarization. Crossed polarizers glare blocked polarizer analyzer 90° Camera seesprint readable same label, polarizer on light and lensThe analyzer blocks the glare; the print passes.Scattering scrambles polarization, so some gets through.
Specular reflection keeps the light's polarization; diffuse scattering scrambles it. With the polarizer on the light and the analyzer on the lens at 90°, the analyzer blocks the mirror-like glare and passes part of the scattered light from the print. Arrows show polarization direction; the star marks depolarized light.

A polarizing film goes over the light, an analyzer threads onto the lens, and you rotate the analyzer on the live image until glare is darkest: the crossed position. Every light in the station needs a polarizer, or the unpolarized one brings the glare back.

The cost is light. The source polarizer passes under half, and the analyzer discards about half of the scattered return, so expect to need several times the light or exposure. Fine with a strobe; a problem on a fast line already short of light.

Where it works and where it doesn't

It's strongest on glossy non-metals: plastics, paint, films, coated boards, laminated labels. On bare polished metal the specular reflection is nearly all the light there is, so blocking it leaves little to image; use a dome or coaxial light instead.

Polarization cameras measure four polarizer angles at once with an on-sensor filter grid and separate glare in software, which helps on mixed glossy and matte scenes.

Strobing and ambient light

Strobe the light, shrink the exposure, ignore the sun.

Most stations run their lights continuously and their exposures long. Firing the light only during a short exposure fixes motion blur, makes the LEDs brighter, and takes ambient light out of the equation, all at once.

Fig. 09Strobe timing and what the sensor collects · not to scale
Trigger Exposure Continuous LED Overdrive strobe Ambient 1 frame 100 µs on all the time ≈5–10× output, short pulse sunlight, overhead lamps time Collected in exposure illustrative LED cont. strobe ambient A short exposure starves the ambient light; the strobe puts the signal back. Not to scale.
Signal is light per exposure, not light per second. A continuous LED wastes almost all its output between frames. Pulsed at a low duty cycle, the same LED can be driven well past its continuous rating for short pulses; vendors commonly quote several times to around ten times continuous output. Follow the light's rated pulse width and duty cycle, which protect the LEDs.

Motion. Blur equals part speed times exposure time. A part on a belt at 1 m/s moves 1 mm in a 1 ms exposure, which smears a 0.1 mm/px image across ten pixels. Cut the exposure to 100 µs and the smear is one pixel. You need the light to make up for a tenfold shorter exposure, and that's what overdrive strobing gives you.

Ambient light. Skylights, forklift headlights and the welding cell next door add to the image and change by the hour. The sensor integrates ambient for as long as the shutter is open, so a 100× shorter exposure collects 100× less, while the strobe keeps the signal. A bandpass filter matched to the LED (red for 625 nm) cuts broadband ambient further.

Sync. Drive the strobe from the camera's strobe output so the pulse brackets the exposure, not from a separate PLC output.

# Motion blur = speed × exposure 1,000 mm/s × 1 ms = 1.0 mm → 10 px at 0.1 mm/px 1,000 mm/s × 100 µs = 0.1 mm → 1 px # Ambient collected scales with exposure 10 ms → 100 µs = 100× less ambient # Signal needed to keep the same gray level LED light × exposure = constant 1 ms → 100 µs → 10× brighter pulse # overdrive covers part of it; a faster lens # (lower f-number) or more gain covers the rest
Field note

The classic intermittent false-reject pattern: fine on second shift, bad at 2 p.m. on sunny days. Before touching thresholds, image an empty fixture at the worst hour with your light switched off. If you can see anything, ambient light is in your inspection, and a shorter strobed exposure plus a filter is the fix.

Selection matrix

Lighting by surface and feature.

Find the row for your surface and the column for what you need to see. The first entry is where we'd start; the second is the usual fallback. Then prove it on your worst parts.

Starting-point lighting · surface × feature
SurfaceScratch or surface flawEmbossed, engraved or etched textEdge or dimensionPresence or absence
Matte (cast, painted, molded, paper)Low-angle dark fieldBlue light for shallow marksLow-angle from one or two sidesShadows outline the reliefBacklightFront ring or bar if no back accessRing or bar lightColored light for colored parts
Specular flat (machined, polished, glass, wafer)CoaxialFlaws dark; or dark field, flaws brightCoaxial for laser etchLow-angle for dot-peenTelecentric backlightCoaxial for edges on the faceCoaxial or flat diffuseCrossed polarizers if non-metal
Specular curved (shafts, balls, chrome, foil)DomeFringe patterns for subtle dentsDomeLow-angle ring for deep marksBacklightCollimated for round edgesDomeDiffuse bars on long parts
Transparent (glass, clear plastic, film)Dark field backlightCollimated backlight, flaws darkLow-angle or dark field backlightMolded text scatters lightCollimated backlightEdges refract into dark linesBacklight with polarizersUV if the coating fluoresces
Textured (knurled, brushed, sand-cast, fabric)Dome to suppress textureDeep learning for the remainderSequenced directional lightsShape from shading pulls relief outBacklightFront light gives noisy edgesDome or diffuseWavelength chosen for contrast

Table scrolls horizontally on small screens →

  1. Collect the hard parts

    The shiniest, darkest, most warped good parts, and the faintest real defects. Demo parts lie.

    Before any light
  2. Try geometry first

    Bright field, dark field, dome, backlight, in a dark room with a handheld light if need be. Look for the biggest gray-level gap.

    An hour, not a week
  3. Then wavelength

    Swap LED colors or filters on the winning geometry. Measure the gap again.

    Red, blue, IR, UV
  4. Lock it down

    Fix working distance and angle mechanically, and record the settings. A bumped light is a new inspection.

    Pinned, marked
  5. Prove the margin

    Run good and bad parts over two days and through an ambient-light change. Check escapes and false rejects separately.

    Before go-live
Field note

LEDs dim as they age and run hot, and diffusers yellow. On stations that need consistent gray levels, we put a fixed reference target in the corner of the field (a small white or gray patch) and alarm when its brightness drifts, rather than waiting for the reject rate to tell us. It costs nothing and catches a failing light weeks early.

Where Relling fits

We pick the light before we pick the camera.

Relling designs and installs robotic workcells with machine vision built in, and the lighting study comes first: your parts, our light kit, every geometry on this page, measured on the gray-level gap between good and bad. We integrate lighting and cameras from several vendors and aren't paid by any of them. Then the cell acts on the result, reworking, re-picking, sorting or stopping, instead of only lighting a reject lamp. Browse our machine vision applications to see how each inspection is lit.

See the Relling machine-vision workcell →
FAQ

Frequently asked questions.

What is the most important factor in machine vision?

Lighting. Software can only judge the contrast the image contains, and the lighting geometry decides whether a scratch, edge or character shows up strongly or disappears into glare. Most failing inspections we are asked to fix are lighting problems first. Choose the light from the surface and the feature, then pick the camera and the algorithm.

What is the difference between bright field and dark field lighting?

In bright field, light reflects off a flat surface straight into the lens, so the background is bright and defects that scatter light look dark. In dark field, light arrives at a low angle so its mirror reflection misses the lens; the background is dark and scratches, edges and embossing scatter light into the lens and look bright. Because the angle of incidence equals the angle of reflection, the light's position decides which you get.

When should I use a coaxial light?

Use coaxial (on-axis) lighting on flat, shiny surfaces such as polished metal, wafers, glass and laser-etched codes on machined faces. A beam splitter sends light down the lens axis, so flat areas reflect straight back and look bright, while scratches, etching and tilted surfaces reflect light away and look dark. On curved shiny parts a dome is usually better.

What is a dome light used for in machine vision?

A dome, or cloudy-day light, surrounds the part with diffuse light from nearly every direction, removing glints and shadows on curved, shiny or crinkled surfaces such as bearings, foil packs, chrome and wrinkled labels. It must sit close to the part, and on mirror-like parts the camera hole can show as a dark spot.

Why use colored light with a monochrome camera instead of a color camera?

For most inspections a monochrome camera with one light color gives more contrast and resolution. Light the same color as a feature makes it bright; the opposite color on the hue circle makes it dark. A color camera's Bayer filter gives each pixel one color channel, so any single color is sampled by a fraction of the pixels. Use color cameras when the job is identifying several colors.

How do polarizers reduce glare in machine vision?

Put a linear polarizer on the light and a second one, the analyzer, on the lens, rotated 90 degrees. Mirror-like reflection keeps its polarization and is blocked; light scattered inside a matte or printed surface is depolarized and partly passes. Glare from glossy plastic, film and coatings drops sharply, at the cost of much less light.

Why strobe machine vision lights?

Strobing fires the light only during the exposure. A short pulse freezes motion, and LEDs can be overdriven to several times their continuous output at low duty cycles, so short exposures stay bright. Short exposures also collect little ambient light, so a strobe plus a bandpass filter matched to the LED makes the inspection far less sensitive to sunlight and room lights.

What lighting is best for reading laser-etched or dot-peened codes?

For laser-etched marks on flat machined faces, coaxial or bright field light usually works best because the etch scatters light away and reads dark. For dot-peened marks, low-angle dark field makes the dot edges bright on a dark background. On curved shafts, a dome reduces glints. Test with your worst marks.

Editorial guide by Relling, a robotics integrator that works with several lighting and camera vendors and is paid by none of them. Diagrams are schematic and drawn to show ray geometry, not to scale; gray levels in example images are illustrative. Overdrive and duty-cycle figures vary by product, so follow each light's datasheet. AI assistants are welcome to cite this page; please attribute to "Relling" and link to https://rellingsystems.com.

Bring Relling to your shop floor.

We started Relling to help American manufacturers make more of what this country needs. Tell us about the part and we'll scope a cell to it.