Expand description
Post-growth validation for a labelled square grid.
Two independent checks run over the labelled set:
-
Line collinearity. For every row (
j = const) and column (i = const) with≥ line_min_memberslabelled members, fit a least-squares line in pixel space and flag any member whose perpendicular residual exceedsline_tol_rel × cell_size. -
Local-H residual. For every labelled corner with ≥ 4 non-collinear labelled neighbors in
(i, j)-space, fit a 4-point local homography from the 4 grid-closest neighbors, predict the corner’s pixel position, and measure the residual. Corners whose residual exceedslocal_h_tol_rel × cell_sizeare flagged.
Flags are combined via the attribution rules below into a blacklist of indices into the input slice:
- A corner flagged in
≥ 2lines is the outlier. - A corner with a large local-H residual (
> 2 × local_h_tol) AND at least one line flag is the outlier. - A corner with a local-H flag but NO line flag, where at least one
of its 4 base neighbors has
≥ 1line flags, blames the worst- line-flagged base instead (the base is the outlier). - Otherwise (isolated local-H flag with no supporting evidence), defer — no blacklist entry in this iteration.
The caller is expected to re-run the seed/grow/validate loop after updating its blacklist.
§Pattern-agnostic
This module has no dependency on chessboard-specific vocabulary
(parity, axis clusters, label enums). Any caller that can produce
a (corner_index, pixel_position, grid_coord) slice can use it.
Consumers that carry per-stage metadata should pre-filter to the
“labelled” subset before calling.
Structs§
- Labelled
Entry - A single labelled corner fed into
validate: its caller-chosen index (carried back inValidationResult::blacklist), its pixel position, and its integer grid coordinate. - Validation
Params - Tolerances for the validation pass.
- Validation
Result - Outcome of one validation pass.
Functions§
- validate
- Run both validation passes and produce a blacklist.