Changes in exposure can reorder detected points by brightness even when their physical positions remain unchanged. Sorting each exposure independently therefore does not preserve feature identity. This procedure is for inspection pipelines that need one stable row per reference feature, with measurements from later exposures placed alongside it. You will register coordinates, build plausible candidate pairs, enforce unique assignments, and retain explicit gaps when a feature disappears. This is spatial correspondence, distinct from matching asynchronous results to acquired frames.
Define the data and matching assumptions
Keep the reference exposure's row order as the output order. Brightness may determine that initial order, but it should not determine correspondence in subsequent exposures.
For each detection, retain these fields:
- Exposure identifier and original detection index.
- Original horizontal and vertical coordinates.
- Measured brightness or another quantity you want to compare.
- Detection quality, saturation status, and localization uncertainty when available.
Create a separate, permanent reference identifier for every reference row. Do not replace that identifier when you sort, filter, or export the data.
This method assumes that corresponding features remain geometrically related across exposures. Translation, rotation, or another justified registration model may explain their movement. Independently moving objects require an additional motion model, while changing feature shapes may require better localization first. The guide to finding tip coordinates across changing shapes addresses that upstream detection problem.
Decide what a correspondence means before implementing the matcher. A broad, saturated spot and a narrow, unsaturated spot may represent the same physical feature but have different measured centers. A matching algorithm cannot correct a systematically biased detector by itself.
Match coordinates in five steps
-
Freeze the reference table. Assign stable identifiers and preserve its original row order. Store brightness alongside coordinates rather than using brightness as an identifier.
-
Normalize coordinate conventions. Express both detection tables in the same units, axis order, and image orientation. Account for cropping, binning, and resizing. Image arrays often use row-column indexing, while geometric routines expect horizontal-vertical coordinates. The coordinate indexing guide explains how these conventions can produce plausible but misplaced overlays.
-
Register the current exposure to the reference. Transform current coordinates into the reference coordinate frame before searching for neighbors. Use known fiducials, stable image content, or reliable initial correspondences. If registration depends on unknown correspondences, begin with coarse alignment or distinctive anchors rather than trusting narrow-gate nearest neighbors.
-
Construct distance-gated candidate pairs. Calculate distances only after registration. Keep a pair only when its separation is within a justified gate. A nearest-neighbor search can accelerate candidate generation, but retain multiple neighbors when more than one is plausible. Keeping only one candidate can remove the correct alternative before assignment begins.
-
Solve a one-to-one assignment. Each reference feature may receive at most one current detection, and each current detection may serve at most one reference feature. Use a bipartite assignment method that supports forbidden pairs and unmatched rows. Do not independently select the nearest point for every reference row and then assume duplicates will not occur.
For translation, add the estimated horizontal and vertical offsets to each current coordinate. For rotation or affine registration, apply the fitted transformation consistently to every current point.
Here, p_j is an original current coordinate, q_j is its registered coordinate, r_i is a reference coordinate, and g is the distance gate. All distances must use the same coordinate units.
Choose the simplest valid registration model
| Model | What it can explain | Main caution |
|---|---|---|
| Translation | Uniform horizontal and vertical displacement | Cannot correct rotation or scale changes |
| Rigid transform | Translation and in-plane rotation | Assumes unchanged scale |
| Similarity transform | Translation, rotation, and uniform scale change | Does not explain perspective changes |
| Affine transform | Translation, rotation, scale, and shear | Can absorb errors if fitted without enough well-distributed evidence |
Fit the model using more than its minimum required correspondences whenever practical. Inspect residuals throughout the field, not just near the anchors. A model fitted to one corner can conceal errors elsewhere.
Set the gate from measured uncertainty
The gate should represent believable residual displacement after registration, not the largest distance that makes every row receive a match.
Estimate uncertainty from repeated acquisitions with unchanged geometry. Measure how much each localized point varies, then assess registration residuals on reliable features. If those errors are approximately independent, a rough per-axis uncertainty estimate is:
For an illustrative estimate, suppose localization uncertainty is 0.3 pixels in each exposure and registration uncertainty is 0.4 pixels per axis:
This is a starting estimate, not a guaranteed acceptance probability. A radial distance gate is not the same as a one-dimensional confidence interval. Correlated errors, saturation, asymmetric spots, and field-dependent distortion can invalidate the estimate.
Compare the gate with typical feature spacing. If several neighboring features routinely fall inside it, geometry alone may not identify them reliably. Improve registration, use stable descriptors, or mark ambiguous matches for review.
Worked example: why independent nearest neighbors fail
Consider two reference points, A at (0, 0) and B at (3, 0). A later exposure contains registered detections U at (0.8, 0) and V at (0.1, 1.5).
Both current detections are individually closest to A. Independent nearest-neighbor queries therefore try to reuse that reference feature.
The squared distances are:
| Candidate pair | Squared-distance calculation | Squared distance | Distance |
|---|---|---|---|
| A–U | 0.8² + 0² |
0.64 | 0.80 pixels |
| B–U | (3 − 0.8)² + 0² |
4.84 | 2.20 pixels |
| A–V | 0.1² + 1.5² |
2.26 | 1.50 pixels |
| B–V | (3 − 0.1)² + 1.5² |
10.66 | 3.26 pixels |
For this arithmetic example, use a gate of 2.5 pixels. The B–V pair is forbidden, while the other pairs remain candidates. This gate is illustrative, not a recommended operating value.
A greedy routine that assigns U to A first leaves V without a valid unused reference. A global one-to-one solution can instead assign V to A and U to B.
If squared distance is the assignment cost, that solution costs:
For validated candidate pairs, one useful objective is to maximize the number of accepted matches first, then minimize their total cost. This is a minimum-cost maximum-cardinality matching problem. State that objective explicitly because assignment libraries do not all handle missing pairs or unmatched detections identically.
When weak matches should remain unmatched, use documented rejection costs or reject ambiguous candidates before solving. The penalty determines when the solver prefers a gap over a distant pairing. Never fill forbidden entries with zero: that makes invalid pairs appear attractive.
Also choose deliberately between distance and squared-distance costs. Both penalize separation, but their global assignments can differ. Squared distance places greater weight on a few large residuals.
Reorder measurements while preserving unmatched detections
Build a mapping from each reference identifier to an assigned current detection index. Then populate the output by iterating through the reference table, not the current brightness ranking.
| Reference identifier | Current detection | Match status | Current measurement |
|---|---|---|---|
| A | V | Matched | Measurement stored with V |
| B | U | Matched | Measurement stored with U |
| C | None | Unmatched reference | Missing value |
Use a missing-value marker supported by your processing environment. Do not enter zero unless zero is a genuine measured quantity. Otherwise, a missing detection becomes indistinguishable from a valid dark measurement.
Retain unmatched current detections in a separate table. They may represent newly visible features, false detections, split spots, or features outside the reference set. Appending them silently would change the meaning of subsequent row positions.
Keep both original and registered coordinates. Original coordinates let you inspect the source image; registered coordinates explain the matching decision. Record the assigned distance and registration version alongside each measurement.
Choose acquisition hardware for repeatable detections
Matching quality starts with repeatable localization. Before replacing hardware, check focus, clipping, image scaling, and changes in thresholding between exposures. Brightness rankings may change legitimately; feature centers should remain stable within your measured uncertainty.
If automatic settings are active, control what they measure. The guide to setting an auto exposure brightness target explains why the metered region matters. Record the actual exposure settings with each image rather than relying only on the requested value.
For stationary image acquisition, compare area scan cameras by the interface, shutter behavior, and image sampling your application requires. Use the camera finder to narrow those choices. Coordinate matching alone does not establish a need for higher resolution or a different interface.
The LS-CMR-0053 provides a GigE option to evaluate against your acquisition requirements.
- Sensor format
- 1/1.7"
- Lens mount
- C-mount
- Interface
- GigE
- Resolution
- 12 MP
The LS-CMR-0166 provides a USB3 alternative for that comparison.
- Sensor format
- 1/1.7"
- Interface
- USB3
- Resolution
- 12 MP
- Shutter
- Rolling
Both catalog entries identify rolling shutters. If the scene moves during acquisition, assess whether row-dependent timing changes the geometry before assuming one rigid transform will align everything. Confirm required exposure controls and software compatibility from the product documentation before ordering.
Verify assignments before processing the full series
Validate the method on a small collection containing easy cases, crowded features, missing detections, and large brightness changes.
Check these invariants automatically:
- Reference order stays fixed. Every exposure produces the same reference-row sequence.
- Assignments are unique. No current detection index appears in multiple matched rows.
- Accepted pairs satisfy the gate. Recalculate distances from the saved registered coordinates.
- Missing features remain explicit. Dropping a detection creates a gap rather than shifting later measurements.
- Input sorting does not affect identity. Shuffle the current detection table and confirm equivalent assignments, except genuinely tied cases.
- Residuals have no unexplained spatial pattern. A directional trend can indicate incomplete registration; radial growth can suggest scale or distortion errors.
Overlay reference points, registered detections, and connecting segments. Long connections, crossed connections in an otherwise regular pattern, and clusters of unmatched rows deserve inspection. A visually tidy overlay is useful evidence, but uniqueness and distance checks still need automated tests.
If matches switch when two detections have nearly equal costs, report ambiguity rather than presenting arbitrary tie-breaking as certainty. Brightness can help only when its behavior across exposures is understood; saturation makes it particularly unreliable as an identity cue.
Before batch processing, confirm the coordinate convention, transformation direction, gate units, unmatched policy, and export order. Save these settings with the output so the same dataset can be reproduced later.
For an acquisition upgrade, start with the camera configurator. If correspondence remains unstable, bring representative images, detection tables, and residual plots to applications support before choosing different hardware.
Questions
Can nearest-neighbor search alone prevent duplicate matches?
Not reliably when several reference points can compete for the same detection. Nearest-neighbor search finds nearby candidates but does not enforce exclusive use. Apply a distance gate, retain plausible alternatives, and solve a one-to-one assignment that explicitly permits missing detections.
How should I choose the coordinate distance gate?
Estimate it from repeated localization measurements and registration residuals in a common coordinate frame. Compare the resulting threshold with feature spacing, then validate it on difficult images. A gate that routinely includes several neighboring features needs additional discrimination, not simply more permissive matching.
What should happen when a feature is missing from an exposure?
Keep its reference row and store a missing measurement with an unmatched status. Preserve newly detected, unassigned points separately. This maintains a stable output layout and prevents one absent feature from shifting every measurement that follows it.
Should brightness be included in the matching cost?
Use brightness only as supplementary evidence when its response is predictable and unsaturated. Exposure changes can alter rankings, while clipping and thresholding can change apparent intensity or location. Stable geometry and validated registration should normally establish correspondence before brightness contributes to the decision.
Do I need registration if the camera does not move?
Registration is needed whenever corresponding coordinates move beyond normal localization uncertainty. A fixed scene with unchanged image geometry may need only an identity transform. Verify that assumption using residual measurements, and revisit it after cropping, resizing, camera movement, or optical adjustments.

