The camera reports a match where no part sits: the robot reaches into empty space, or a part-present signal fires on a bare tray. That is a false pattern match, and it almost always traces back to one decision made at teaching time: the detection threshold was set while looking only at good parts on a clean bench. The fix is a measured one. You scan the real work plane with the part removed, log the worst false score, log the lowest true part score, and place the threshold between the two with margin on each side. The procedure below gives the arithmetic, the checks, and the background fixes that remove the false scores at their source.
Why a matcher reports a part that is not there
A normalized pattern matcher compares the taught model with every candidate position in the image and returns a similarity score, usually scaled from 0 to 1. The score is not a probability that a part is present; it measures how closely the gray-level pattern matches what you taught. Tray ribs, screen print, a specular streak and a shadow edge all carry structure, so all of them produce scores. The matcher cannot tell a part from a reflection.
The detection threshold is the only line between them, and if you never measured where the background's scores fall, you drew that line blind. The template matching score thresholds guide explains what the score value itself means, and the coarse search threshold guide shows how the threshold gates the search once it runs.
In practice the causes rank like this, most common first, each with a quick test:
- Threshold never tested on the real background. The model was taught and the number picked against perfect parts on a bench. Test: remove the part and run detection; any hit is a false hit by definition.
- Background structure. Ribs, engraving, brushed metal or printed film carry edges just like a part does. Test: the empty-plane scan in the next section maps exactly where the high false scores sit.
- Specular reflections. A glossy tray or film reflects the light as a bright streak that moves with part position. Test: slide the part a few millimeters and watch the score jump.
- Ambient light change. Daylight and occupancy-controlled overheads shift every score through the day. Test: log the worst false score early and late in one shift.
- Shadows from off-center parts or fixtures. The tests and light-position fixes are in the edge shadow guide.
- A near-symmetric model. A part rotated 180 degrees matches its own model and reports a hit in the wrong orientation. Test: rotate the part 180 degrees in the fixture; the 180-degree flip fix covers the acceptance settings.
Scan the empty work plane first
Run this at production lighting, production exposure and production focus, with tray and fixtures exactly as they will ship. Scores move with every one of those settings, so a bench run under different light proves nothing. The scan gives you the two numbers every threshold decision needs.
- Lower the detection threshold to a deliberately permissive value, 0.30 for this sweep; the working value comes later.
- Remove the part completely. Keep tray, fixtures, film and packaging in place.
- Run detection and log every hit with its score and position. The highest score logged is S_false_max, the worst false score of the scene.
- Look at the corners specifically: vignetting and stray reflections concentrate there, and corner hits are common even when the center is clean.
- Put the part back and run 12 placements across the plane, each in 4 orientations within the search range, 48 runs in all. Log every score; the lowest is S_true_min.
If the empty plane stays clean even at 0.30, the background is not the problem; skip ahead to the production-only causes further down.
Set the threshold between the two measured scores
Set 0.83, not a round 0.90. Rounding upward feels safe but it spends the true-side margin: at 0.90 the gap to the worst true part is 0.94 − 0.90 = 0.04, below the 0.05 minimum you should keep on each side of the threshold. Decide the number from the measurements and record the arithmetic in the commissioning report so the next engineer can re-derive it.
If the spread S_true_min − S_false_max is under 0.10, no usable threshold exists. A 0.10 spread leaves 0.05 margins, and one dirty tray or an aging lamp moves scores by more than that. Stop tuning the threshold and fix the image instead.
Two checks close the loop. Run the empty plane at the new threshold: it must return zero hits. Then run the worst part you still accept and confirm its score clears the threshold with the 0.05 margin intact.
When the spread is too small, fix the image
Threshold tuning cannot separate a part from a background that looks like the part. These changes push S_false_max down and S_true_min up, and each one buys real margin:
- Crossed polarization. A polarizing filter on the light crossed with one on the lens removes the specular streaks that glossy trays and films produce, and those streaks are usually the highest-scoring false features in a shiny scene.
- Diffuse illumination. A dome light surrounds the part with light from every direction, so curved and glossy parts image evenly and the background loses its hot spots.
- Dark-field geometry. Low-angle dark field lights edges and leaves a uniform background dark, so background texture that lit the score in bright field often stops producing any score at all.
- A matte background. A dark matte tray under a light part maximizes the part-to-background contrast the model was taught on.
- A tighter search region. Every square millimeter of background inside the region of interest is another chance for a hit; the ROI placement guide shows how tight to cut it for 2D and 3D cameras alike.
- Edge-based matching. A uniform background contributes no gradient, so edge-based matching ignores it. This is the reliable answer when the background is busy and cannot be changed; the edge-based matching guide covers the switch.
Re-run the full scan after any of these changes; every one of them moves both scores.
Sensor choice helps too. Matching runs on gray levels, so color contributes nothing to the score, and a mono sensor avoids the channel shifts that mixed lighting produces. The MV-SC5060XM-08M-WBN pairs a 6 MP mono sensor with an 8 mm lens on an M12 mount, a common fit for locating small covers on a line.
- Interface
- GigE
- Resolution
- 6-10 MP
- Sensor format
- 1/2.4"
- Shutter
- Rolling
Causes that only show up in production
If the scan is clean and the threshold holds on the bench, but phantom matches return on the line, work through these in order:
- Ambient light. Sun angle, skylights and switching overheads move scores through the day; the ambient light control guide shows how to stabilize the station.
- Vibration. Shock and vibration shift the image between frames, and doubled edges create structure the model partly matches. Compare a frame captured on a stopped line with one captured live; the pixel shift guide walks the test.
- Handshake repeats. The camera's result is correct but a stuck handshake bit re-delivers an old match. Log the raw results at the camera and at the PLC; if the camera reports nothing where the PLC saw a part, the matcher is innocent.
- A changed background. A new tray supplier, new stretch film or a replaced diffuser changes the scores you measured. Re-run the scan after any such change.
- Standalone pattern sensors. A dedicated pattern sensor fails the same way and responds to the same measured-threshold method; a pattern sensor false-reading walkthrough works one such case end to end.
Keep the threshold honest over time
Prevention costs minutes once the measurements exist:
- Save two golden scenes: the empty plane and the worst-case part placement. After any change of lamp, tray, diffuser, exposure or gain, re-run both and re-derive the threshold with the same formula.
- Log the best match score of every cycle and alarm when it drifts 0.05 below its baseline. Falling true scores come before both false hits and missed parts as a lamp ages.
- Lock exposure, gain and the lighting controller's channel values, and treat any change to them as a re-validation event, not a tweak.
The applications topic page collects more of these field-tested fixes.
Hardware and next steps
On a smart camera or vision sensor the whole loop — image, model, threshold, output — runs on the device, so the teach-and-scan procedure takes minutes and can be repeated after every scene change. The MV-SC3050XC-16M-ATN-H is a 5 MP color vision sensor with a global shutter and an M12 lens mount built for that kind of on-device locate.
- Interface
- Fast Ethernet
- Resolution
- 5 MP
- Sensor format
- 1/1.45"
- Shutter
- Global
For presence checking at one fixed station, the camera locate presence-check guide shows the logic. A fixed-focus sensor then holds the geometry constant by design: the MV-SCA002M-03S-WBN-SR pairs a 0.3 MP mono sensor with a 3 mm lens focused at 240 mm, and a scene that never moves keeps its score margin for years.
- Interface
- Fast Ethernet
- Resolution
- Up to 3 MP
- Sensor format
- 1/6"
- Shutter
- Global
If your scan says the scene itself cannot be fixed, compare mono, global-shutter models in the smart cameras category or the camera finder, and when a stubborn scene needs a lighting or geometry opinion first, send the description through the contact page.
The configurator matches a camera, lens, light, light controller and cables to each other, step by step, and lists only parts that fit what you already picked.
Questions
Can I just set the detection threshold to 0.95 to be safe?
No. Scores are relative to one taught model on one scene, so 0.95 can sit below the background's features in a messy scene or above every true part in a low-contrast one. Derive the threshold from your measured S_false_max and S_true_min instead, and re-derive it whenever the model is re-taught, because a new model rescales the whole score range.
Should the pattern be taught with the background in the image?
Yes, teach with the part sitting on the production tray under production lighting. The model then learns the part-to-background edges that anchor true matches, and the scores you measure in the scan belong to the same contrast you will run with. If you later change the tray material or color, re-teach as well as re-measuring, because the model's strongest edges change with it.
Do exposure and gain changes affect false matches?
They change every score, so treat them like a lighting change. Higher gain amplifies noise edges in the background, which tends to pull S_false_max up faster than the true scores move. After any exposure, gain or lighting-controller change, re-run the empty-plane scan and the worst-part run, and re-set the threshold with the same formula rather than keeping the old number.
How many positions and orientations should the teaching scan cover?
At least 20 to 30 part placements spread across the whole work plane, each in several orientations within the search range. Corners and far edges matter most, because vignetting and stray reflections concentrate there and produce the highest false scores. Also test at the rotation limits of the search range, since a near-symmetric part can otherwise produce flipped matches that the scan misses.
The scan is clean on the bench but false hits return in production — what now?
Look at what production adds: daylight through skylights, overheads that switch with occupancy, a second tray stacked under the first, stretch film glare, or a thin oil film on the part. Shroud the station or add controlled lighting, then re-run the empty-plane scan at the worst lighting hour of the day, not under bench conditions. The threshold must be proven at production's worst, not its average.


