LightingExplainer

Distinguishing scratches from dust with lighting

Distinguish scratches from dust with two lighting passes: a diffuse dome and a low-angle dark-field bar, one camera pose, a decision rule and the pixel math.

LumaSpec Vision12 min read Share on LinkedIn

On this page 9 sections
  1. 01Why does one dark-field image confuse scratches with dust?
  2. 02What physical difference does lighting expose between a scratch and a particle?
  3. 03How do you set up the two lighting passes?
  4. 04How do you read the two images to make the call?
  5. 05What pixel size and lens does the test need?
  6. 06Which lights fit the two passes?
  7. 07What breaks the two-pass method in production?
  8. 08When is cleaning dust the better fix than classifying it?
  9. 09Questions

Line inspectors keep flagging scratches on machined, moulded and painted parts, and a cloth wipe proves that half of those marks were dust. Sorting a real groove from a loose particle in software alone fails exactly where it hurts: point-shaped scratches and round particles look alike in any single image, in size and in contrast. The fix sits on the lighting side, not in the algorithm. You will set up two passes over one camera pose — diffuse, then low-angle dark field — read them with a persistence rule, size the optics with pixel math, and learn when an air blast upstream beats any classifier.

Why does one dark-field image confuse scratches with dust?

In a single dark-field image a scratch and a dust particle are both bright features on a dark background. A blob analyzer therefore sees two populations with overlapping sizes: particles of 20-200 µm and scratch segments of similar width cannot be told apart by area, roundness or brightness alone.

Dark field is still the right first move for surface marks. It rejects the flat mirror reflection and keeps only scattered light, so a fine scratch out-shines its background while the polished surface stays black. The difficulty starts at segmentation: both the scratch segment and the particle become bright connected components, and for each the contrast depends on local geometry. Shape rules catch continuous scratches with an aspect ratio of 5:1 or more, but chatter marks, pits and short slash marks are round — statistically the same population as dust. Brightness fails too, because a large soft particle can out-contrast a shallow scratch. One image does not carry the information that separates a mark in the surface from an object on it, and no threshold trick creates it. The scratch detection workflow with dynamic thresholding sharpens what you see; the second lighting pass is what decides.

What physical difference does lighting expose between a scratch and a particle?

A scratch is a groove with two tiny walls, and it stays put in every lighting geometry. A dust particle sits on top, flares under grazing light and fades to a faint shadow under diffuse dome illumination.

That asymmetry is the whole method. Under grazing dark field the scratch walls mirror light toward or away from the camera, so the mark appears — bright, dark or as two edges — always in the same place with the same shape. The particle scatters strongly and casts a long shadow, so it flares. Under a dome, light arrives from every direction at once: shadows cancel, a small particle lifts the local background by a few percent, and the groove still interrupts the near-axial field as a thin reflectance change. Which geometry puts which feature into which bucket is mapped in the light geometry selection guide, and the reflection law behind bright and dark field explains why the mirror image disappears.

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.

Stains and subsurface marks behave like neither: they change reflectance rather than topography, so they can show clearly in the diffuse pass while staying quiet in dark field. That third signature is not noise. It is the route to a stain classifier instead of a scratch reject.

How do you set up the two lighting passes?

Hold the camera pose fixed and fire a diffuse dome for pass one and a low-angle bar for pass two on the same stationary part. Aim both exposures so a flat reference area lands at 60-70 % of saturation in each image.

Set the geometry first. For flat specular parts, mount the bar so its rays graze at 15-25° above the surface plane: low enough that the mirror reflection misses the lens, high enough that flatness errors do not swing the reflected beam across the field. Below about 10°, a 0.5 mm bow across a 45 mm part tilts the local surface by 0.6°, and a grazing reflection moves by twice that — enough to wipe whole regions dark. The dome wants its emitting area at about twice the field width so rays arrive near-axially everywhere; dome lights are sized from under 50 mm to over 400 mm, and the dome geometry guide for shiny curved parts walks through the sizing.

Then lock the acquisition. Use the same camera gain in both passes, because a gain change alters noise and breaks the comparison; only exposure may differ, since every feature is judged against its own local background. Trigger dome and bar from one controller, tens of milliseconds apart or inside one stationary window — the multi-angle sequential lighting scheme for glossy parts runs on exactly this trigger idea. Expect the dark-field pass to need a strobe or roughly an order of magnitude more exposure than the dome pass, because it collects only the scattered fraction; treat that factor as a starting estimate, not a spec.

One dome artifact to recognize early is the camera hole. The dome aperture prints a dark region near image centre on shiny parts, and it sits in both passes, so the persistence rule will not remove it — identify it once and mask it, as the dome camera hole fix explains.

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.

How do you read the two images to make the call?

Apply the same segmentation to both passes and compare feature by feature: persistence above a 10 % contrast floor with matching geometry means scratch, dark-field-only presence means dust, and diffuse-only contrast means a stain or a subsurface mark.

Run the comparison in order:

  1. Segment each pass against a local background map, not one global threshold, so brushed or textured ground does not flood the detector.
  2. Register the two images. One camera pose keeps them pixel-aligned; let the part edges confirm registration to within 1-2 pixels.
  3. For every dark-field feature, look up the same pixels in the diffuse pass and compare skeletons and footprints, not grey values — a groove can be bright in one pass and dark in the other.
Dark-field pass Diffuse pass Call
Visible, thin Visible, same path Scratch
Bright, compact Absent or soft shadow Dust particle
Faint or absent Visible mark Stain, residue or subsurface mark
Nothing Nothing Clean surface

Matching geometry, not matching polarity, is what makes the rule hold for point-shaped scratches: a chatter mark keeps the same round footprint in both passes, while a dust particle keeps its flare only under grazing light.

What pixel size and lens does the test need?

Size the optics so the smallest scratch you must catch spans at least 2 pixels: for a 50 mm field on a 4000-pixel sensor that is 12.5 µm per pixel and a 25 µm minimum reliable feature width.

Two pixels is the sampling floor for a believable width reading and for a blob that must keep some interior pixels; it binds the dust side too, because particles below 25 µm cannot produce a two-pixel-wide response on this optics. The lens choice therefore sets your dust tolerance, not the software.

pixel size = FOV / horizontal pixels smallest reliable width = 2 × pixel size m = sensor width / FOV f = WD × m / (1 + m)

Worked example, a 45 × 35 mm anodized aluminium lid with a 25 µm scratch spec:

  1. Field of view: 50 mm wide leaves mounting margin around the 45 mm part.
  2. Pixel size: 50 mm / 4000 px = 12.5 µm per pixel; the 2-pixel floor gives 25 µm.
  3. Sensor width: 4000 px × 1.67 µm ≈ 6.7 mm.
  4. Magnification: m = 6.7 mm / 50 mm = 0.134.
  5. Lens: at f = 12 mm, WD = 12 × (1 + 0.134) / 0.134 ≈ 102 mm; check m = 12 / (102 − 12) = 0.133, so FOV = 6.7 / 0.133 ≈ 50 mm.
  6. Depth of field at f/4: DOF ≈ 2 × N × pixel × (1 + m) / m² = 2 × 4 × 1.67 µm × 1.134 / 0.134² ≈ 0.84 mm, ample for a flat lid and quickly eaten by a bowed or curved one.
  7. Lighting: dome emitting area 2 × 50 mm = 100 mm minimum; bar lit length at least the field diagonal, √(45² + 35²) ≈ 57 mm.

The resolution calculator pairs field width and pixel count and links cameras with enough pixels, the lens focal length calculator runs step 5, and the working distance and field of view formula derives the same magnification chain from scratch.

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

The worked example assumes this camera, 4000 × 3000 frames over USB3:

Area scan cameras12 MP USB3 area scan camera, IMX226, 1/1.7" rolling shutter, 30 fps, 4000 × 3000 resolution (LS-CMR-0166)LS-CMR-0166
Sensor format
1/1.7"
Interface
USB3
Resolution
12 MP
Shutter
Rolling
$560.00View partBuild a system with it

Browse the area scan cameras list or the camera finder with the mono filter: scratch and dust calls run on grey values, and a mono sensor returns more signal per pixel than its colour equivalent.

Which lights fit the two passes?

Match the dome's emitting area to about twice the field width so rays arrive near-axially across the whole image, and give the dark-field pass a high-luminance bar long enough to cover the field diagonal at 15-25° grazing.

The dome earns its footprint on brushed, textured or lightly wavy metal: light from every wall direction averages out the reflectance swing, so the groove survives and the brush pattern fades. Where a dome cannot fit, a flat coaxial diffuse light shares the lens axis and does the same job on flat or gently curved parts. For the example field the dome wants 100 mm of emitting area or more.

The LS-DOM-0085 provides a Ø116 mm emitting area in a Ø166 mm body.

Dome lightsØ166 mm dome light, Ø116 mm emitting area (LS-DOM-0085)LS-DOM-0085
Size
100-200 mm
Voltage
24 V
from $409.00View partBuild a system with it

The example field's diagonal is 57 mm, and trials will slide the bar along it. The LS-BAR-0400 is a 312 × 30 mm high-luminance bar light with the strobe headroom a scattered-light pass needs.

Bar lights312 x 30 mm High luminance bar light (LS-BAR-0400)LS-BAR-0400
Size
200-400 mm
Type
Standard
Voltage
24 V
$459.00View partBuild a system with it

Wider fields take two opposed bars to even out the along-scan falloff. The bar lights list filters by length and diffusion, and the lights finder narrows by wavelength — the infrared options sit at 850 and 940 nm, where fine roughness also scatters well and room lighting stops competing.

What breaks the two-pass method in production?

The method fails when the part moves between passes, when ambient light leaks into the dark-field exposure, or when curved or wavy surfaces redirect the dome light enough to mimic scratch contrast.

Motion is the first budget to check. At 100 mm/s belt speed the image shifts one 12.5 µm pixel every 0.125 ms, so a 1 ms dome pass plus a 0.5 ms bar pass already smears about 12 pixels; the pair only stays registered below roughly 8 mm/s (12.5 µm / 1.5 ms ≈ 8.3 mm/s). Above that, stop the part under the camera or index it into a fixture. The low-angle bar layout for moving boards shows the trigger side of moving-line lighting.

Ambient light creeps into dark-field exposures because they run long next to the dome pass. An enclosure fixes it outright; where one cannot go, a red bar with a matching bandpass filter rejects most room lighting, and the bandpass filter with red light article gives the numbers.

Curved and wavy parts bend the dome's own field: a polished shoulder can print a dark arc that persists in both passes and mimics a scratch. Correct it with a per-part background map for each pass, restrict the rule to low-curvature zones, or borrow the checks in the rounded-corner uneven lighting article and the glossy panel scratch inspection guide.

Transparent parts blur the line between surface and bulk: dust on top and a subsurface stria both scatter in dark field, and persistence alone cannot say which is which, so expect to add a focus-diverse or angle-diverse pass there.

Stuck-on contamination — dried coolant, adhesive spatter, embedded swarf — survives an air blast, persists in both passes and gets classified as a surface defect. That is the right answer: it is on the part whether or not the spec has a name for it.

When is cleaning dust the better fix than classifying it?

If good parts arrive with more than roughly a hundred visible particles each, no lighting rule will hold the false-reject rate down: move the dust problem upstream with an ionized air blast before the camera and let the two-pass test police what lands afterwards.

Loose dust is a process problem with a simple physical fix. Ionized air strips charged particles off plastic and painted housings in a fraction of a second of line time, and it needs no classifier to maintain. Vision then handles what lands between the air knife and the camera, and the count it reports doubles as a cleanliness metric for the upstream process.

Set the budget before commissioning. If a clean part carries a hundred particles and the customer tolerates two dust rejects per thousand parts, arithmetic — not tuning — says the particle classifier must be near-perfect; spend the effort on the air, the packaging and the handling first. Once the load drops to a handful of particles per part, the persistence rule holds its floor and marginal calls become auditable instead of constant.

If the two-pass test fits your station, start in the lighting configurator at the dome and bar steps, or send a photo of the part plus the smallest scratch your spec names through the contact page and we will size the pair with you.

Questions

Can a single dark-field image ever separate dust from scratches?

Only partially. Long scratches give a high aspect ratio, but point-shaped marks — chatter marks, pits, porosity — overlap dust in area and roundness, exactly where single-image rules fail. If a second lighting pass is impossible, expect to reject loose dust as scratches or remove it physically; persistence across two passes is the reliable separator.

Does the colour or wavelength of the light change the discrimination?

It changes what each pass emphasizes. Blue light sharpens fine surface contrast on shiny metal, while red and the common infrared bands at 850 and 940 nm see deeper into some plastics and ignore thin colour stains. Keep both passes at the same wavelength so the comparison stays honest, and switch wavelength only when one pass must ignore a specific nuisance.

How much contrast should a feature show before the system calls it a scratch?

Start at 10-15 % above the local background in each pass, then tune on about 20 known-good and 20 known-scratch parts from the line, including the dustiest ones. Log every feature within 3 % of the floor for the first week; where the marginal cases pile up tells you which way to move the floor.

The dome pass still shows the dust faintly — does that break the comparison?

No, because the rule demands persistence with matching geometry, not mere presence. A large particle can appear in both images: bright and compact in dark field, a soft displaced shadow in the diffuse pass. Compare skeletons and footprints between the passes; a compact dark-field blob without a matching diffuse signature still classifies as dust.

Can the two passes run on a moving conveyor?

Only inside one registered window. At 100 mm/s a 12.5 µm pixel shifts one pixel every 0.125 ms, and two strobed passes rarely fit inside that budget, so the images smear. Stop the part under the camera, or fire the pair inside an encoder-defined dwell and register the images afterward.