An edge filter run at a sensitive setting finds the crack — and a few thousand noise pixels with it. Filter the same scene several times at different settings, stack the binary results and keep only the pixels every run marks, and the noise falls out while the crack stays. This guide gives the decision rule (three settings minimum), the arithmetic that sets your expectation, the alignment conditions, a six-step recipe in plain array code, a k-of-N vote for faint cracks, and the cases where the fix belongs in the lighting or the mechanics rather than the logic. It is written for anyone inspecting cracks, seams or scratches on a fixtured part.
Does intersecting edge maps from different filters really remove noise?
Yes — keep a pixel only when every edge map marks it: false pixels land in different places in each map, the crack edge lands in the same place every time, and at a 0.1% per-frame false rate three maps cut 12,000 false pixels on a 12 MP image to under one.
The operation is a pixel-wise AND on binary maps. Convert each filtered image to 0/1, then keep the pixel only where every map is 1:
Each filter hallucinates edges in different places: Canny's non-maximum suppression cuts where the gradient peaks, Sobel's raw magnitude spreads wider, and every threshold moves the cut again. A crack is a real gray-level step, so every setting marks it within a pixel or two; random speckle does not repeat, so the intersection kills it.
Two assumptions carry the p^N estimate. The false pixels must be independent across maps — never intersect N runs of the identical threshold, because identical settings correlate the noise and the AND keeps it; vary the setting so they decorrelate. And the true edge must appear in every map, which faint or 1-pixel cracks fail; that case gets its own vote below.
The consensus step comes after segmentation, not instead of it: choose the crack segmentation approach first, then fuse its binary output across settings.
How many edge images do you need before the noise disappears?
Three images is the practical minimum: the residual false-pixel rate falls as p^N, so a 0.1% per-frame rate becomes 1 × 10⁻⁹ after three frames, about 0.012 expected false pixels on the 12,000,000-pixel frame worked through below.
Worked example on a 12 MP frame. Take the LS-CMR-0166, a 12 MP USB3 camera whose printed specification is 4000 × 3000 resolution at 30 fps.
- Sensor format
- 1/1.7"
- Interface
- USB3
- Resolution
- 12 MP
- Shutter
- Rolling
The arithmetic, with one assumed input you measure on your own images:
The 0.1% is the only assumed number. Measure it: run your filter on a known-good part, count the white pixels and divide by 12,000,000. A 12,000-pixel count means p = 0.001 and the block above applies to your station directly.
Independence is the best case. If a false pixel that appears once reappears with probability r in each other map — structural noise from surface texture does this — the residual rate is p × r^(N−1). At r = 0.5 and N = 3 that is 0.001 × 0.25 = 2.5 × 10⁻⁴ per pixel, or 3,000 pixels on the same frame. That is what most stations actually see until the settings are varied, and varying them costs nothing.
Check which regime you are in: intersect two maps of a known-good part. A handful of survivors means you are near the independent case; thousands mean the noise is structural and needs different settings or different lighting.
What do your images need to have in common before you compare pixels?
The maps must come from the same scene, captured with the part, camera and lighting held fixed, then registered so that pixel (x, y) means the same physical point in every image; even a 1-pixel shift breaks the consensus and erases thin edges.
The easy case is one capture, N filters: acquire a single image of the fixtured part and run Canny at three thresholds plus Sobel at the same blur scale on it. Pixel (x, y) is the same physical point in every map by construction, so alignment is free and only the settings vary.
If you capture N frames instead — different exposures or different strobed lights — the part must not move between frames and the illumination must repeat. On a conveyor, freeze the part inside one exposure window with the strobe; if any shift is possible, register the gray images by cross-correlation before filtering, and accept whole-pixel shifts only, because sub-pixel smear erases exactly the thin edges you are protecting.
Every map must also be the same size, binary 0/1, and filtered at the same smoothing scale — the blur radius or aperture — because the scale sets where the algorithm draws the edge. If brightness drifts between captures and the thresholds drift with it, run a flicker diagnosis before trusting any N-frame result.
How do you build the consensus image step by step?
Binarize every edge map to 0/1, count how many maps mark each pixel, keep the pixels that reach your vote threshold, then clean the result with one morphology pass — six steps below take N binary maps to one consensus image in a few lines of array code.
- Capture one image of the stationary part into a uint8 grayscale array of 3000 rows × 4000 columns (this example's frame size; substitute your own).
- Build N binary maps from it. For k = 1 to 3, set edge_map[k] = filter_k(img) > threshold_k, a Boolean array of the same 3000 × 4000 shape. Pick threshold 1 just below the setting where the crack disappears, threshold 2 at it, threshold 3 above.
- Count votes per pixel: votes = edge_map[1] + edge_map[2] + edge_map[3], an integer array with values from 0 to 3.
- Threshold the votes. consensus = votes == 3 is the strict AND used so far; votes >= 2 is the tolerant majority for faint cracks.
- Clean the consensus. Remove isolated pixels with one 3 × 3 erosion, or keep only 8-connected components of 5 or more pixels.
- Read out the result. The surviving components are the crack candidates; their pixel count and centroid are the two numbers that leave the vision step.
These are generic array names that any image-processing library implements in a line or two each. The count from step 6 is a per-part measurement: log it across repeated runs and average it per part the way you average any measurement before judging drift.
How do you verify the consensus kept the crack and not just an empty image?
Compare counts: if a single map carries 12,000 false pixels and the consensus carries zero on a good part but one thin cluster on the cracked part, the fusion works; an empty consensus on the cracked part means per-frame detection fell below 1 and you need the vote below.
Two runs prove the pipeline. First the empty test: run the full chain on a known-good part, where each map still carries its 12,000 false pixels at p = 0.001 — the consensus must return exactly 0. Then the crack test: the consensus must be non-empty and sit on the crack within a pixel or two.
| Symptom | Good part | Cracked part | Meaning and fix |
|---|---|---|---|
| Noisy | more than 0 pixels | large clusters | Structural noise: thresholds too low or too similar — vary them or change the light |
| Too strict | 0 pixels | 0 pixels | Per-frame detection below 1: switch to the k-of-N vote |
| Working | 0 pixels | one thin cluster on the crack | Ship it |
An empty consensus on the cracked part is the failure to take seriously: the strict AND demanded the edge in all three maps and a faint crack missed one. That is a recall problem, not a noise problem, and no amount of threshold tuning repairs it — the vote does, in the next section.
What do you do when the true edge misses the consensus by a pixel or two?
Replace the strict AND with a k-of-N vote after dilating each map by 1 or 2 pixels: with per-frame detection at 0.7, a 3-of-5 vote keeps the crack with probability 0.84, computed below, while expected false pixels stay near 0.12 on the same 12,000,000-pixel frame.
The strict AND multiplies the crack's own survival probability too. If each map finds a faint crack with probability q = 0.7, all three find it with 0.7³ = 0.343 — worse than any single map. Dilate each binary map with a 3 × 3 kernel to absorb the pixel-to-pixel jitter between operators, then vote instead of intersecting:
A 3-of-5 vote catches that crack with probability 0.84, up from 0.70 for a single map. The false side moves the same way: with p = 0.001, P(≥3 of 5) ≈ 10 × (0.001)³ ≈ 1 × 10⁻⁸ per pixel, which is 0.12 expected false pixels on the 12,000,000-pixel frame — still invisible.
Set k = floor(N/2) + 1, so 2 of 3 or 3 of 5. Each step up in k buys noise margin and costs crack recall, so tune k on parts, not on paper.
When is combining edge maps the wrong fix?
Skip the consensus when the noise is surface texture, the illumination is not repeatable, or the part moves between captures: then every map carries the same false edges, the AND keeps them, and the fix belongs at the lighting or the mechanics, not the logic.
Texture. Brush marks, weld ripples and machining lines produce real gradients, so every map marks them and the fusion freezes them into the result. No logic removes them; change the illumination so the surface stops producing that gradient. On white plastic, dark-field and glancing-angle lighting for crack detection makes the crack itself the brightest or darkest line in the scene, and the maps come out nearly clean before any fusion.
Unrepeatable illumination. If flash energy or ambient light drifts between captures, each map encodes a different contrast and the stack compares incomparable scenes; lock the exposure with closed-loop light control before combining anything.
Motion. On a moving line, grab one frame per part and vary the filter settings on that frame — consensus across shifted frames fails as the alignment section showed.
What hardware gives you frames clean enough to combine?
You need a camera that repeats the same frame geometry at a stable exposure and a strobed light that fires the same way every cycle; a 12 MP USB3 area camera with a 4-channel, 24 V, 200 W digital strobe controller covers both ends of that list.
Fixture the part or the camera, trigger from a fixed point in the cycle, and strobe the light so ambient light never reaches the sensor. For capture, browse the area scan cameras; the camera finder filters by resolution, shutter and interface, and the configurator matches camera and lens to your field of view. The LS-CMR-0166 card above is the 12 MP class this example used. For lighting, the light controllers page filters by channels and output type; the LS-CTL-0070 below is a 200 W box with four 24 V channels and RS232 control, so one box drives a white inspection channel and a colored second channel.
- Output
- Constant voltage 24 V
- Channels
- 4 channels
- Control
- Digital
- Feature
- Strobe
If the inspection should live on the camera itself, smart cameras run threshold-and-vote logic on the device at the low resolutions where vision sensors concentrate — most models in the category are 3 MP or below; the FAQ below covers that split.
To turn your own numbers into a parts list, take the pixel count, N and your measured p to the lighting step of the configurator, read the other systems guides on grabbing, thresholds and counting, or send your images through the /contact/ page and the team will check which noise regime you are in.
Questions
Does the AND trick work on grayscale edge magnitudes without thresholding?
Threshold each map to binary first. Grayscale magnitudes are not comparable across operators: Sobel gradient magnitude and Canny's suppressed response live on different scales, so a pixel-wise minimum or average mixes unrelated units. Binarizing puts every map on the same 0/1 scale, which is what makes the intersection meaningful. If you need graded confidence, binarize each filter at several thresholds and vote across the whole set.
Should I vary the blur scale as well as the thresholds between maps?
Change thresholds, keep the smoothing scale fixed. The blur radius or aperture size before the gradient decides where the algorithm draws the edge; change it and the edge shifts a pixel or two, so the strict AND erases exactly the thin cracks you wanted to keep. Different operator families at one common scale — say Sobel and Canny on the same blurred image — combine well, because the edge stays put while the noise decorrelates.
How much better is four maps than three?
The gain is small and the cost is real. On the independent model the residual rate falls from p³ = 10⁻⁹ to p⁴ = 10⁻¹², which on a 12 MP frame means 0.012 expected false pixels against 0.000012 — both invisible. Meanwhile every extra map is cycle time and one more chance for a faint crack to miss one frame, which is why three frames plus a k-of-N vote usually beats five strict ones.
Can a smart camera run this consensus on the device?
Yes, if its inspection program can threshold one image under several settings and combine the binary results in the same run — vision sensors handle that easily at their working resolutions, and most models in the category are 3 MP or below. For 12 MP frames times N maps, do the array work on a PC next to the camera and pass only the consensus result downstream; the on-device route then covers the simpler stations on the line.
Why not average the raw images before edge detection?
Averaging N raw frames cuts random sensor noise by about the square root of N — roughly 1.7× at N = 3 — which helps faint edges but not filter noise: the averaged image is cleaner, yet each filter still hallucinates edges wherever texture meets threshold. Do both when you can, average the captures for signal and intersect the maps for structure, but only the intersection removes false edges.

