System designHow-to

Dynamic ROI adjustment to part position: blob anchor method

Dynamic ROI adjustment: when the part position shifts each cycle, blob probes give offset and tilt and the inspection region is transformed before counting.

LumaSpec Vision11 min read Share on LinkedIn

On this page 9 sections
  1. 01Why a fixed rectangle fails first
  2. 02Anchor to probes, not to the plate contour
  3. 03What you need
  4. 04Set it up in six steps
  5. 05Worked example: 200 × 150 mm plate, ±5 mm shift and ±2° tilt
  6. 06How small a speck stays detectable
  7. 07Common mistakes that break the anchor
  8. 08When blob anchoring is the wrong tool
  9. 09Questions

A fixed rectangular ROI only works while the part lands in the same place every cycle. On a belt-fed or hand-loaded station the plate arrives offset by a few millimetres and a degree or two off square, and the pixel counter starts calling plate edges and bare conveyor foreign material. The fix is not a cleverer ROI shape but a different reference frame: find the plate's position and tilt with two or three small blob probes, then move and rotate the inspection region with the plate before every inspection. This guide gives the method, the formulas, a worked example with the arithmetic shown, and the checks that keep the anchor honest.

Why a fixed rectangle fails first

The ROI is taught against a plate sitting square in frame. The next plate sits lower and turned: on one side the region now contains bare belt, on the other the plate's bright edge lands inside the region and its high-contrast transition reads exactly like a foreign particle. Widening the guard band helps until the guard is bigger than the area you actually inspect, and defects near the edges escape by design.

Tilt is the worse of the two errors, because rotation displaces the corners most: the ends of a long plate swing several times farther than its centre. A guard band sized for the centre is too small for the corners, and one sized for the corners eats the face of the plate. Both failures share one root: the ROI is pinned to the camera instead of to the part. Pin it to the part and both errors disappear at once.

Anchor to probes, not to the plate contour

The tempting alternative is to fit the ROI to the plate's detected outline, so the region follows the contour wherever the plate goes. Do not make the contour the boundary of your inspection region: a foreign particle that touches or crosses the plate edge changes the contour, and the region shrinks away from exactly the defect you need to see. Glare on shiny copper and fingerprints notch the outline the same way.

The working method is cheaper and stronger. Place two or three small probe ROIs on features that are always plate: corner pads, a machined notch, a straight stretch of edge away from the corners. Blob each probe every cycle, combine the centroids into the plate's offset and tilt, and transform the inspection region into that measured frame. The inspection region keeps a fixed shape in plate coordinates, so a speck on the edge cannot move it.

A blob mask still has a legitimate job: run it as a second region to exclude bare belt outside the plate, on top of the anchored region. On a plain matte belt with defects strictly interior, mask-only inspection is also workable; it just gives up every edge defect by construction.

What you need

  • A camera platform with a blob tool, a pixel counter or defect tool, and a way to transform a region between cycles. On smart cameras the transform usually ships as a position-compensation or align step for the ROI list; menu names differ, the math below is the same.
  • Contrast at the probes: a matte, uniform belt behind the plate, and diffuse or polarized light on shiny copper so glare does not create false edges.
  • A taught reference image with the probes in place.
  • Measured placement tolerances: log 30 cycles and record the minimum and maximum offset and tilt the belt actually produces.

For inspection on the camera itself, a smart camera carries the whole job. The LS-SMC-0063 runs 1.6 MP at 60 fps with a 16 mm lens and built-in polarized white light, which helps on reflective copper. The MV-SC3050XC-16M-ATN-H is a 5 MP color vision sensor on Fast Ethernet with an M12 mount. The MV-SC5060XM-08M-WBN steps up to 6 MP mono over GigE with an 8 mm M12 lens for finer specks. The MV-SC6050C-08M-XBN is a 5 MP color model with a global shutter and an integrated multi-color light source. The camera finder filters by resolution, shutter and mount.

Smart cameras & vision sensors1.6 MP smart camera, 60 fps, 16 mm lens, white light (polarized, transparent light) (LS-SMC-0063)LS-SMC-0063
Interface
GigE
Resolution
Up to 3 MP
$1,110.00View part
Smart cameras & vision sensorsHikrobot MV-SC3050XC-16M-ATN-H 5 MP color vision sensorMV-SC3050XC-16M-ATN-H
Interface
Fast Ethernet
Resolution
5 MP
$1,809.00View part
Smart cameras & vision sensorsHikrobot MV-SC5060XM-08M-WBN SC5000X series Smart Camera, 6 MP, Mono, 8 mm focal length, M12-mountMV-SC5060XM-08M-WBN
Interface
GigE
Resolution
6-10 MP
$1,629.00View part
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
$3,449.00 · quotedView and quote

When the camera is a plain GigE model, or several cameras share one recipe, the anchoring math runs on a vision controller instead. The MV-VC3301H-128G66 pairs an Intel Core i3 with 8 GB of memory, five or more LAN ports and 4 built-in light channels, with the VM6200Pro vision runtime license included. The MV-VC5525-256G70-NN moves up to a 12th-generation Core i5, 32 GB of memory, PoE camera ports and 8 built-in light channels for multi-light stations.

Vision controllersHikrobot MV-VC3301H-128G66 I3-8100, 8GB+128G SSD, No PoE, PCIe expansion supported, Incl. VM6200Pro licenseMV-VC3301H-128G66
LAN ports
5+ LAN ports
USB 3 ports
3-4 USB 3 ports
$2,419.00View part
Vision controllersHikrobot MV-VC5525-256G70-NN VC5000 Vision Controller, 12th-I5, 32GB+256G SSD, Supported PCIEMV-VC5525-256G70-NN
LAN ports
5+ LAN ports
USB 3 ports
3-4 USB 3 ports
$4,479.00 · quotedView and quote

Set it up in six steps

  1. Teach the nominal pose. Put a plate in its intended position, run the probes, and store the anchor centroids A0 and B0, their midpoint M0, and the taught angle θ0.
  2. Place and size the probes. Centre each probe on a feature that is always plate, and size its window from the worst-case excursion: placement shift, plus the rotation sweep at that probe's radius from the plate centre, plus about 1 mm of margin. The worked example below runs the numbers.
  3. Measure every cycle. Threshold and blob each probe and take a sub-pixel centroid. If shading across the plate drifts, adaptive thresholding for uneven part shading keeps the probes from walking off their features. Mind the pixel origin too, because a half-pixel offset in blob centroids shifts every anchor identically and only partly cancels in the angle.
  4. Compute the pose. Take dx and dy from the midpoint shift and θ from the anchor-to-anchor vector. Deliberately tilt a plate by about 2° and check the sign: platforms that count y downwards flip the sense of the angle.
  5. Transform the inspection region. Rotate and translate every vertex of every inspection ROI into the measured frame; round to whole pixels only after the transform.
  6. Inspect and log. Run the pixel counter or defect tools inside the transformed region and store dx, dy and θ with each result. Bind each ROI to the transformed coordinates rather than the taught ones — the classic ROI image source binding error is a region that silently stayed home.

Worked example: 200 × 150 mm plate, ±5 mm shift and ±2° tilt

Inputs. A 200 × 150 mm copper plate on a matte belt, with two corner pads on the front edge serving as anchors. The camera frames a 320 mm × 256 mm field on a 2560 × 2048 pixel sensor, so the scale is 320 mm / 2560 px = 0.125 mm/px. Assume the belt stop leaves the plate within ±5 mm and ±2°; replace these with your own logged values.

Taught anchors sit on the pads at A0 = (480, 1400) and B0 = (2080, 1400), exactly 1600 px = 200 mm apart. The taught midpoint is M0 = (1280, 1400), the plate centre is (1280, 800), and each anchor is r = √(800² + 600²) = 1000 px from the centre. This cycle the probes report A' = (492, 1393) and B' = (2074, 1402).

Rule. Translation is the shift of the anchor midpoint; rotation is the angle of the anchor-to-anchor vector; every inspection vertex is rotated about and translated onto the measured midpoint. Here R is the 2 × 2 rotation matrix and θmax your worst-case tilt.

dx, dy = M' - M0 theta = atan2(By - Ay, Bx - Ax) - theta0 V' = M' + R(theta - theta0) * (V0 - M0) probe window >= shift + r * sin(theta_max) + margin

Arithmetic.

  1. M' = ((492 + 2074)/2, (1393 + 1402)/2) = (1283, 1397.5), so dx = 1283 − 1280 = +3 px = +0.38 mm and dy = 1397.5 − 1400 = −2.5 px = −0.31 mm.
  2. B' − A' = (2074 − 492, 1402 − 1393) = (1582, 9), so θ = atan2(9, 1582) = 0.0057 rad = 0.33°.
  3. A taught inspection corner V0 = (1280, 1000) gives V0 − M0 = (0, −400). Rotating by 0.33° gives (400 × sin 0.33°, −400 × cos 0.33°) ≈ (+2.3, −400.0), so V' = (1283 + 2.3, 1397.5 − 400.0) ≈ (1285, 998).
  4. Probe window: shift 5 mm = 40 px, rotation sweep r × sin 2° = 1000 × 0.0349 = 34.9 px, margin 1 mm = 8 px. Window ≥ 40 + 34.9 + 8 = 82.9 px, so set ±85 px. This assumes the tilt pivots near the plate centre; a plate rocking about an edge doubles the 34.9 px term.

Result. The plate sits 3 px right, 2.5 px up the image and 0.33° off square. The anchored ROI follows both moves, so the pixel counter sees the same band of copper it saw at teach.

Decision. A fixed ROI would need a guard band against the worst edge wander: 40 px of shift plus 800 px × sin 2° = 27.9 px of corner sweep plus the 8 px margin, i.e. 75.9 px = 9.5 mm all round, leaving (200 − 19) × (150 − 19) = 23,711 mm² inspectable. The anchored ROI needs about 1 mm, leaving (200 − 2) × (150 − 2) = 29,304 mm². The difference, 5,593 mm², is roughly 19% of the plate face returned to inspection. If your logged tolerances ever demand a probe window wider than about half the plate's short side, add a locating stop or nest instead of wider probes.

How small a speck stays detectable

Anchoring guarantees the region is on the metal; resolution decides what you can still catch inside it. A workable rule of thumb is that the smallest feature a threshold tool separates reliably spans about 3 pixels across; confirm the number on your own images before promising it to anyone. At the worked example's 0.125 mm/px that is 3 × 0.125 = 0.375 mm, so a 0.4 mm speck is the realistic floor for that set-up.

If the specification calls for 0.2 mm particles, the pixel budget must reach 0.2 mm / 3 = 0.067 mm/px, which on the same 2560 px sensor means a field no wider than 0.067 × 2560 = 171 mm — tighter framing, or a higher-resolution sensor at the same field. The camera resolution calculator runs this trade-off the other way: enter the field and the smallest feature, and it returns the pixels required.

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

Common mistakes that break the anchor

  • Probes on the plate edge. The edge is the thing that moves. Probe features must sit fully on the plate at the worst-case placement, and they must be features a defect cannot plausibly occupy: pads and notches, not open face area.
  • A busy belt. A textured conveyor gives the probes edges of their own to find. The background must be uniform, so the only blobs inside the probe windows are plate features.
  • Auto exposure left on. Gain and exposure changes move apparent edges between cycles, and the anchors wander with them — the same mechanism behind contour position jitter under automatic exposure. Lock both.
  • Carrying the last reference forward. When a probe finds no blob, fail the cycle as a no-read and stop. Never reuse the previous offset and tilt.
  • Symmetric plates. If the plate can arrive flipped 180°, two symmetric probes cannot tell the poses apart; add an asymmetric reference feature before trusting the angle.

When blob anchoring is the wrong tool

  • Shifts too large for the probes. If the excursion approaches the probe window or the field, the honest fix is mechanical: a locating stop, a nest, or a vision-positioned pusher. Wider probes and more pixels only postpone it.
  • Parts without stable small features. Castings and odd shapes may not offer two clean pads. One template match that returns position and angle does the same job as the probes, at more computation per cycle. If results still drift under rotation, the diagnosis path for vision pick error under rotation applies here unchanged.
  • The part moves during exposure. No transform recovers a blurred edge. Trigger on a sensor and keep the exposure short; on a continuously tracked line, keep the probes as search regions and let position come from the encoder — the search region versus position region split used in line tracking inspection.

Anchored ROIs turn a placement problem into a few lines of arithmetic per cycle. For a new station, size the pixel budget first, then pick the camera and controller around it: the system configurator walks the chain in order, and the systems topic page collects the surrounding techniques. Questions about a specific line go through the contact page.

Questions

Can the plate's own blob contour be used as the pixel-counter ROI?

It can, but only as a mask laid over an anchored region, not as the boundary itself. A foreign particle that touches or crosses the plate edge changes the contour, so the mask shrinks away from the very defect you need to see. Glare patches and fingerprints notch the contour the same way. Keep the inner inspection region anchored to the probes, and use the blob mask only to exclude bare belt outside the plate.

How many blob probes does the anchor need?

Two are the minimum for offset plus tilt in the image plane. Three are worth adding whenever a probe can fail: a particle landing on a probe pad shifts that centroid, and with three anchors the outlier can be outvoted or the cycle failed cleanly. If the plate can also arrive flipped 180°, symmetric probes cannot tell the two poses apart, so add one asymmetric reference feature for orientation.

How repeatable is a blob-anchored ROI?

Expect the reference to repeat within one to two pixels when edge contrast is good and exposure is locked, which is 0.13 to 0.25 mm at the worked example's 0.125 mm per pixel. That repeatability is what lets the guard band drop from 9.5 mm to 1 mm. It scales with pixel size: a finer millimetres-per-pixel tightens both the anchor and the guard band together, while low edge contrast is what widens it.

Can the ROI follow the part while the belt is still moving?

Only if motion blur stays under about one pixel. Blur equals belt speed times exposure: at 0.2 m/s and a 0.5 ms exposure that is 0.1 mm, just under one pixel at 0.125 mm/px, so it works. Trigger the camera from hardware rather than software, keep the exposure short, and re-run the anchor test on moving parts before you trust the readings.