Goal
Refine pixel-level chessboard corner positions to sub-pixel accuracy by fitting a seven-parameter continuous model of an ideal chessboard corner directly to a raw image patch, without prior filtering. Input: a grayscale image and a set of pixel-level corner positions supplied by any coarse detector. Output: sub-pixel corner locations where is the displacement from the pixel-level estimate to the fitted corner centre, together with a per-corner fit-quality weight for use in downstream pose estimation. The model encodes Gaussian optical blur and a linear photometric transform, and the fit residual serves as a built-in quality metric for outlier rejection.
Algorithm
Let denote the grayscale image. Let denote coordinates within the ROI centred on , with – px. Let denote the sub-pixel offset of the true corner from the pixel-level estimate, along and respectively. Let denote the rotation angle of the first edge crossing the corner. Let denote the rotation-plus-shear angle of the second edge. Let denote the intensity gain mapping the binary model to the observed grayscale range. Let denote the intensity offset. Let denote the width of the Gaussian blur PSF. Let denote a 2-D isotropic Gaussian kernel with standard deviation . Let denote the approximation constant for the -based surrogate of the Gaussian error function; for 8-bit images.
A sign function along edge angle through the shifted corner:
The ideal corner model is the product of two such sign functions along edges at angles (rotation) and (rotation plus shear):
which takes values in the four quadrants of the ROI defined by the two crossing edges.
The blurred model is the convolution of the ideal model with the Gaussian PSF:
The scaled model maps to the observed intensity range via gain and offset :
Introduce the composite angles
The Gaussian convolution integral is separated by integration by parts; the cross-term remainder is estimated explicitly from and added back. The Gaussian error function appearing in the separated integrals is replaced by
yielding a tractable closed-form expression for .
Given observed intensity values at ROI pixels , the residuals are
The objective is the sum of squared residuals over the seven parameters:
The refined corner position is
Per-corner RMSE over the residuals:
Across the full board, compute quartiles of and assign the reliability weight
The interval is the adjusted boxplot fence of Hubert and Vandervieren — wider than the standard fence — to accommodate skewed residual distributions. The downstream PnP cost is weighted by , so corners failing the self-check do not influence pose estimation.
Procedure
- Extract the ROI patch around each .
- Initialise parameters: , ; set from the upstream edge-extraction result; set and from the mean gray levels of the local black and white patch regions.
- Evaluate using the closed-form -based surrogate for , with remainder compensated via .
- Compute residuals over all ROI pixels.
- Form the Gauss–Newton normal system on the seven parameters and apply the update; repeat until convergence.
- Recover the refined corner: .
- Compute for every corner on the board.
- Compute the adjusted boxplot interval from of the board-level RMSE distribution and assign .
- Pass to the downstream PnP or planar-calibration solver as weighted correspondences.
Implementation
The closed-form surrogate model evaluator and per-pixel residual — the inner kernel called by every Gauss–Newton iteration — in Rust:
/// Evaluate the scaled blurred-corner model C_s(u,v) at one pixel.
/// Inputs: ROI-centred coordinates (u, v), seven model parameters.
/// Returns the predicted intensity, using tanh(ρ·) as the erf surrogate.
fn model_intensity(
u: f32, v: f32,
mu: f32, nu: f32,
alpha: f32, beta: f32,
lambda: f32, kappa: f32, sigma: f32,
) -> f32 {
const RHO: f32 = 1.1;
let theta1 = 0.5 * (beta - alpha);
let theta2 = 0.5 * (beta + alpha);
let s = sigma * core::f32::consts::SQRT_2;
let x1 = ((u - mu) * theta1.cos() + (v - nu) * theta1.sin()) / s;
let x2 = ((u - mu) * theta2.cos() + (v - nu) * theta2.sin()) / s;
let cf = (RHO * x1).tanh() * (RHO * x2).tanh();
lambda * cf + kappa
}
/// Sum of squared residuals over the (2r+1)^2 ROI patch — the LSQ cost
/// minimised over (μ, υ, α, β, λ, κ, σ).
fn sse(roi: &[f32], r: usize, p: &[f32; 7]) -> f32 {
let side = 2 * r + 1;
let mut acc = 0.0;
for row in 0..side {
for col in 0..side {
let u = col as f32 - r as f32;
let v = row as f32 - r as f32;
let pred = model_intensity(u, v, p[0], p[1], p[2], p[3], p[4], p[5], p[6]);
let res = roi[row * side + col] - pred;
acc += res * res;
}
}
acc
}
/// Per-corner RMSE feeding the boxplot self-check (Eq. 11).
fn corner_rmse(roi: &[f32], r: usize, p: &[f32; 7]) -> f32 {
let n = ((2 * r + 1) * (2 * r + 1)) as f32;
(sse(roi, r, p) / n).sqrt()
}
A standard Gauss–Newton or Levenberg–Marquardt loop wraps these primitives, using either an analytic Jacobian derived from model_intensity or finite differences. The fit's only paper-specific element is the surrogate evaluator above; the rest of the pipeline reuses generic LSQ machinery. The board-level boxplot weight is computed once after all corners are fit by quantile estimation on .
Remarks
- Per-corner cost is for a fixed seven-parameter system; each Gauss–Newton step solves a normal system, independent of . Total cost scales linearly with the number of detected corners on the board.
- ROI radius – px is the practical sweet spot: smaller radii reduce the available fitting support; larger radii capture lens-distortion curvature that violates the locally-straight-edge assumption built into the model.
- The approximation introduces a closed-form error that is small for on 8-bit images; the explicit remainder via tightens the surrogate further. The constant requires re-tuning for inputs with dynamic range other than 8 bits.
- The method operates on raw image patches without pre-filtering, eliminating the noise floor introduced by preprocessing steps such as cone or Gaussian filtering used by polynomial-saddle approaches.
- The boxplot self-check uses the Hubert–Vandervieren adjusted fence, which is wider than the standard fence; this accommodates skewed residual distributions arising under non-uniform illumination without rejecting valid corners unnecessarily.
- The method is a refinement step, not a standalone detector: it requires pixel-level corner positions from an upstream coarse detector and produces no result when is missing or lies outside the ROI of the true corner.
- Convergence assumes the upstream initialisation of from edge extraction is accurate enough that the seven-parameter Gauss–Newton system is in the basin of the true minimum; quality of the angle initialisation directly affects the final fit.
References
- T. Yang, Q. Zhao, X. Wang, Q. Zhou. Sub-Pixel Chessboard Corner Localization for Camera Calibration and Pose Estimation. Applied Sciences, 8(11), 2018. DOI: 10.3390/app8112118. PDF
- Z. Zhang. A Flexible New Technique for Camera Calibration. IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(11)–1334, 2000. PDF
- V. Lepetit, F. Moreno-Noguer, P. Fua. EPnP: An Accurate O(n) Solution to the PnP Problem. International Journal of Computer Vision, 81(2)–166, 2009. PDF
- S. Placht, P. Fürsattel, E. A. Mengue, H. Hofmann, C. Schaller, M. Balda, E. Angelopoulou. ROCHADE: Robust Checkerboard Advanced Detection for Camera Calibration. ECCV, 2014.
- C. Harris, M. J. Stephens. A Combined Corner and Edge Detector. Alvey Vision Conference, 1988. PDF