LightingGuide

Teach a vision model that survives changing colors and finishes

Teach the vision model on the darkest, glossiest part, light it for edges not color, and locate parts reliably across changing colors and finishes.

LumaSpec Vision11 min read Share on LinkedIn

On this page 10 sections
  1. 01Why gray-level models break on color and finish
  2. 02Light for edges, not for shade
  3. 03Teach the worst sample, then widen
  4. 04Worked example: a 5 MP sensor resolving a 2 mm chamfer at an 80 mm field of view
  5. 05Hardware that fits the job
  6. 06Choose the setup by variation type
  7. 07Keep teach and run on one plane
  8. 08Checks before you freeze the teach
  9. 09When the usual answer is wrong
  10. 10Questions

A taught locate model is only as strong as the contrast it was taught on, and few things tear contrast apart like a batch that arrives in whites, browns and blacks, matte and gloss. This guide is for anyone teaching parts to a wrist-mounted or fixed camera for picking and assembly. You will decide which lighting geometry carries the model, which physical sample to teach first, and whether the camera resolves the features you plan to teach — with the arithmetic shown. The short version: light for edges, teach the worst part in the batch, and set the acceptance threshold from the sample that images worst.

Why gray-level models break on color and finish

The camera builds its model from contrast steps in the teach image: every brightness step becomes a feature with a position and a gray value. Under one fixed light, a matte white cap reads near the top of the gray range, a glossy black one reads as bright highlights scattered over dark voids, and a brown one lands between them. Gray levels follow shade and finish. The position of a real edge — a chamfer, a hole, a moulded boundary — does not.

That split decides everything. If the features that carry the model are gray-level patches, such as dark print on a light body, the model dies the day the shade changes. If they are edge and silhouette features, a shade change only weakens the contrast, and a score threshold absorbs the difference. The matcher side of this is covered in the guide on edge based pattern matching when lighting changes; the lighting side is the subject here.

So decide first what carries the model: geometry. Every choice below — light geometry, teaching sample, threshold — exists to make edges visible on every part in the batch. The same logic applied to mirror finishes is the chrome part teaching guide, and the run-time side of staying located across finishes is in part localization across surface finishes.

Light for edges, not for shade

Diffuse light removes the directions that make gloss dangerous. A dome envelops the part from every side at once, so no single reflection angle catches the lens and no directional shadow survives; flat faces return even gray and boundaries stay crisp. On shiny, curved or wrinkled parts it is the default geometry.

How a dome light works LEDs at the rim light the white inner surface of the dome, which lights the part evenly from almost every direction. The camera looks through a hole at the top; on flat mirror-like areas the hole reflects as a dark spot.Cameradiffuse inner surfacelights the part from every sideLED ringcamera holecurved or wrinkled part; dark spot where the hole reflects
How a dome light works. LEDs at the rim light the white inner surface of the dome, which lights the part evenly from almost every direction. The camera looks through a hole at the top; on flat mirror-like areas the hole reflects as a dark spot.

On a wrist or cell camera looking down at parts tens of millimetres across, a diffused 0° ring mounted close to the part behaves like a local dome and wraps the part in soft light without the bulk. A 70° ring does the opposite: it grazes the surface, so flat fields return dark while every edge, chamfer and texture step glints. That is dark-field contrast, and because the surface angle sets the brightness, it survives any paint color.

Bright-field and dark-field lighting geometry High-angle light reflects off the flat surface straight into the lens, so the surface looks bright. Low-angle light reflects away from the lens, so the surface looks dark and only edges or scratches scatter light upward.flat part with a scratchCamerabright field(high angle)dark field (low angle)flat areas reflect away;only the scratch sends light up
Bright-field and dark-field lighting geometry. High-angle light reflects off the flat surface straight into the lens, so the surface looks bright. Low-angle light reflects away from the lens, so the surface looks dark and only edges or scratches scatter light upward.

Both ring types below come from the ring lights category and are 120 mm in diameter on 24 V: the LS-RNG-0426 diffuses at 0° for dome-like softness, while the LS-RNG-0810 grazes at 70° for dark-field edge contrast. The light finder filters both by diameter, angle and wavelength, and the ring vs bar geometry guide covers when a bar shape fits better.

Ring lightsRing light, 120 mm dia., 0°, White (LS-RNG-0426)LS-RNG-0426
Size
100-200 mm
Type
Diffused
$369.00View part
Ring lights120 mm dia. ring light, 70° (LS-RNG-0810)LS-RNG-0810
Type
Standard
Angle
70°
$319.00View part

Monochromatic light simplifies shade one step further. Red 620 nm light turns whites, browns and blacks into ordered gray steps — brighter paint, brighter pixel — while edges keep their positions, which turns a shade call into a threshold instead of a classification problem. The channel logic is worked through in the grayscale contrast color guide. The LS-RNG-0100 provides exactly this: 620 nm red light across a 120 mm ring at a 60° angle on 24 V.

Ring lights120 mm dia. ring light, 60°, 620 nm, 24 V (LS-RNG-0100)LS-RNG-0100
Size
100-200 mm
Type
Standard
Angle
60°
Voltage
24 V
$179.00View partBuild a system with it

Gloss that still flares under diffuse light gets crossed polarizers, one on the light and one crossed on the lens; the pair removes the specular sheen and leaves the diffuse component that edges produce. The cross polarization guide gives the alignment procedure.

Teach the worst sample, then widen

Choose the teaching sample by who images worst: the darkest, glossiest part in the batch. It produces the fewest and weakest edges, so a model locked onto those edges also locks onto every lighter and matte part. Teaching on a matte white sample points the other way — its strong full-field contrast vanishes on black gloss, and the model fails at run time with nothing warning you at teach time.

Widen from there. Present the lightest matte sample and confirm every model feature still scores. Then set the acceptance threshold on the worst good part: start at 0.70 and raise it in 0.05 steps until the worst good sample passes with a small margin. Log that number per finish so a falling trend surfaces long before the first reject.

Two run-time rules keep the teach honest. Fix exposure and gain and switch every auto mode off, because auto exposure quietly re-balances gray levels between finishes — the brightness drift guide shows the failure and the fix. Strobe the light on the snapshot trigger as well, so motion blur and ambient light add nothing to the image the model sees; the ambient light control guide covers shrouding and timing.

Worked example: a 5 MP sensor resolving a 2 mm chamfer at an 80 mm field of view

The case: an assembly cell locates a 50 mm connector cap that arrives in white, brown and black, matte and gloss, and grips it by the top face. The inputs, with their sources:

  • Field of view: 80 mm across, chosen as about 1.6 times the cap so the grip offset fits (job assumption).
  • Sensor: about 2,500 pixels across — the right order for any 5 MP machine-vision sensor (catalog class assumption).
  • Smallest model feature: the 2 mm chamfer around the cap top, typical of a moulded edge (job assumption).
  • Rule of thumb: a feature must span at least 3 pixels to carry a model (standard matching practice).

The rule in words: one pixel covers the field of view divided by the number of pixels across it, and a feature's span in pixels is its size divided by that pixel footprint. Clear 3 pixels and geometry can carry the model; miss it and no lighting choice rescues the teach.

pixel footprint (mm/px) = field of view (mm) ÷ pixels across feature span (px) = feature size (mm) ÷ pixel footprint (mm/px)

The arithmetic, step by step: 80 mm ÷ 2,500 px = 0.032 mm per pixel. The chamfer spans 2 mm ÷ 0.032 mm/px = 62.5 px, which rounds to 63 pixels. Margin over the floor: 63 ÷ 3 ≈ 21 times. Smallest usable feature: 3 px × 0.032 mm/px ≈ 0.10 mm.

Result: the chamfer spans about 63 pixels, 21 times the 3-pixel floor. Decision: at an 80 mm field of view on a 5 MP sensor, teach the cap on its chamfer and outline — features no finish can move — and treat surface shade as noise. Any feature of 0.10 mm or larger clears the floor at this field of view. If your smallest feature is under 0.10 mm at 80 mm, shorten the working distance or step up in pixel count instead of hoping contrast holds.

Camera resolution for the smallest feature
Units
Pixels needed
–
Sensor size
– MP
Smallest sensor that fits
–
Pixel on the part
– mm
Pixels across the feature, that sensor
–

Pixels needed = field / feature × pixels per feature on each axis (field incl. margin). The lens must resolve the pixels too: Nyquist = 1000 / (2 × pixel µm) lp/mm.

Find cameras with enough pixels Open the full calculator

Hardware that fits the job

A camera with built-in, switchable light keeps these geometry decisions on one device. The smart cameras category holds the integrated models, and the camera finder filters by resolution, sensor format and shutter.

The MV-SC6050C-08M-XBN is a 5 MP color smart camera with an 8 mm M12 lens, a global shutter and a built-in multi-color light source, so illumination color can switch between part colors without new hardware.

Smart cameras & vision sensorsHikrobot MV-SC6050C-08M-XBN SC6000 Series Smart Camera, 5 MP, Color, 8 mm focal length, M12-mount, Multi-color light sourceMV-SC6050C-08M-XBN
Interface
GigE
Resolution
5 MP
Sensor format
1/1.45"
Shutter
Global
$3,449.00 · quotedView and quote

The MV-SC3050XC-16M-ATN-H is a 5 MP color vision sensor with a global shutter, a 1/1.45" sensor and an M12 mount on Fast Ethernet — the lighter pick for a wrist snapshot position.

Smart cameras & vision sensorsHikrobot MV-SC3050XC-16M-ATN-H 5 MP color vision sensorMV-SC3050XC-16M-ATN-H
Interface
Fast Ethernet
Resolution
5 MP
Sensor format
1/1.45"
Shutter
Global
$1,809.00View part

External rings need a controller that can strobe and sequence them. The light controllers category, the controller finder and the configurator's controller step all filter by channel count and strobe support. The LS-CTL-0070 is a four-channel digital control box rated 200 W with strobe control over RS-232, enough to sequence a diffuse and a grazing ring from one trigger.

Light controllersDigital control box, 4 ch, 200 W, RS232 (LS-CTL-0070)LS-CTL-0070
Output
Constant voltage 24 V
Channels
4 channels
Control
Digital
Feature
Strobe
$549.00View partBuild a system with it

Choose the setup by variation type

Batch variation Light geometry What carries the model Teach first on
Whites to blacks, matte to gloss Diffused 0° ring or dome, close in Outline and chamfer edges Glossiest black part
Shades vary, all matte 60-75° low-angle ring Edge glints on a dark field Darkest shade
Color fixed, gloss varies Diffuse light plus crossed polarizers Edges with specular sheen removed Glossiest part
Colors must be told apart Geometric locate, then a color step Edges locate; hue sorts Not applicable — locate is color-blind

Pick the row that matches the worst variation you receive, not the average part. Where two rows apply, take the harsher geometry: a diffused 0° ring also serves matte parts, while grazing light over high-gloss paint restores the highlights you were trying to remove.

Keep teach and run on one plane

Locate accuracy holds at the height the camera was calibrated on. If part tops sit nearer the lens than the calibration plane, image scale grows by roughly lens-to-calibration distance divided by lens-to-part-top distance. With the lens 100 mm above the calibration plane and the part top 10 mm nearer, scale reads 100 ÷ 90 ≈ 1.11 — about 11 percent oversize — which skews every pixel-to-millimetre map and grip offset built on it. Hold every snapshot position at the calibration height, or calibrate at part-top height as the inclined work plane guide describes.

Checks before you freeze the teach

  • The teaching sample is the darkest, glossiest part in the batch, shot under production lighting.
  • Every model feature spans at least 3 pixels on the worst sample — 0.10 mm or larger at an 80 mm field of view.
  • Exposure and gain are fixed, every auto mode is off, and the light is strobed on the snapshot trigger.
  • The acceptance threshold comes from the worst good sample, starting at 0.70 and rising in 0.05 steps.
  • The full finish matrix runs: lightest and darkest, matte and gloss, rotated 90° between shots.
  • Snapshot positions and models are saved with the installation and confirmed after a reload.

Light output drift belongs on the maintenance list for the same reason pose drift does; the fiducial pose drift guide traces the chain from lighting to failing matches.

When the usual answer is wrong

When color is the product. Sorting red caps from gray caps is a color job: locate geometrically first, then classify hue inside the located region. Deliberate color classification needs controlled, often colored illumination; the error to avoid is letting color carry the locate model.

When shape is degenerate. Flat washers and all-black O-rings offer no top-down edge a model can hold. Switch to a backlight for a silhouette, fixture the part, or follow the black O-ring lighting guide.

When gloss floods everything. A mirror finish reflects the whole station, dome included. Drop to shape-only teaching as the chrome guide shows, add the crossed polarizers above, or weigh dome against grazing as the engraved metal lighting comparison lays out.

The decision, restated: light for geometry, teach the worst sample, check the pixel budget, and freeze the threshold on the worst good part. To pick ring, camera and controller as one system, start at the configurator's light step; the lighting topic page collects the surrounding guides, and the argument for margins over bare contrast continues in why adequate contrast is not enough.

Questions

Should I teach a separate model per color?

No — one geometric model should serve the batch. Teach it on the darkest, glossiest part under production lighting; lighter and matte parts then score against the same model. Split into per-color models only when one shade carries a boundary feature the others lack, and expect to maintain a separate acceptance threshold per model.

How do I check the pixel budget on my own field of view?

Divide the field of view in millimetres by the sensor's pixel count across to get the pixel footprint, then divide the smallest feature you want to teach by that footprint. Anything at 3 pixels or more can carry a model: at 80 mm on about 2,500 pixels the footprint is 0.032 mm and the floor lands near 0.10 mm.

Do snapshot positions need re-teaching for each new program?

No. Snapshot positions, calibration data and taught models are saved with the cell's installation data and load again with it, so additional programs reuse them. Re-teach when the part design, the fixture height, the working distance or the lighting changes, because each of those changes the image the model was built from.

Can the camera sort shades after locating the part?

Yes. Locate on edges, which every finish shows, then classify shade inside the located region. A red 620 nm light maps whites, browns and blacks onto ordered gray levels, so one threshold separates them; note that the ordering changes with wavelength, so re-tune the threshold if you switch light color.

What if specular highlights still break the model?

Cross-polarize first: a polarizing film on the light and a crossed one on the lens strips the specular sheen and keeps the diffuse component that edges produce. If edges still wander, move to a dome or a close diffused 0° ring so highlights have no directional home, or teach outline, holes and corners only.