Localized Radon Checkerboard Corners | VitaVision
Back to atlas

Localized Radon Checkerboard Corners

6 min readIntermediateView in graph
Based on
Accurate Detection and Localization of Checkerboard Corners for Calibration
Duda, Frese · British Machine Vision Conference (BMVC) 2018
DOI ↗

Goal

Detect the inner corners of a checkerboard pattern in a grayscale image and return their subpixel coordinates. Input: an image I:ΩRI : \Omega \to \mathbb{R} on pixel domain ΩZ2\Omega \subset \mathbb{Z}^2. Output: a set of subpixel pixel locations {(xi,yi)}\{(x_i^\ast, y_i^\ast)\} marking point-symmetric X-junctions of bright and dark quadrants. The response is built from 1-D line integrals rather than gradients, so it is robust to image noise, low contrast, and moderate blur; accuracy approaches 1/1001/100 pixel on crisp inputs.

Algorithm

Let I:ΩRI : \Omega \to \mathbb{R} denote the grayscale image. Let (x,y)Ω(x, y) \in \Omega denote pixel coordinates. Let α[0,π)\alpha \in [0, \pi) denote a ray angle. Let mm denote the half-length of the line-integral window, in pixels. Let A={0,π/4,π/2,3π/4}\mathcal{A} = \{0,\, \pi/4,\, \pi/2,\, 3\pi/4\} denote the discrete angle set. Let rotβ\mathrm{rot}_\beta denote rotation of an image about its centre by angle β\beta with bilinear sampling.

Definition
Localized Radon transform

Directional line integral through (x,y)(x, y) at angle α\alpha, of half-length mm:

Rflocal[x,y,α]=k=mmI(x+kcosα,  y+ksinα).R_f^{\text{local}}[x, y, \alpha] = \sum_{k=-m}^{m} I\bigl(x + k \cos\alpha,\; y + k \sin\alpha\bigr).
Definition
Corner response

Squared gap between the brightest and darkest directional integrals over A\mathcal{A}:

fc[x,y]=[maxαARflocal[x,y,α]    minαARflocal[x,y,α]]2.f_c[x, y] = \Bigl[\,\max_{\alpha \in \mathcal{A}} R_f^{\text{local}}[x, y, \alpha] \;-\; \min_{\alpha \in \mathcal{A}} R_f^{\text{local}}[x, y, \alpha]\,\Bigr]^{2}.

At a point-symmetric X-junction the integral along a centreline through two bright sectors is maximal and along a centreline through two dark sectors is minimal; the gap is squared to keep the response non-negative and to sharpen the local maximum.

Definition
Box-filter approximation

A 1-D horizontal box blur of half-width mm:

fblur[x,y]=12m+1i=mmI[x+i,y].f_{\text{blur}}[x, y] = \frac{1}{2m + 1} \sum_{i=-m}^{m} I[x + i,\, y].

Each line integral is obtained by rotating the image into alignment with the xx-axis, blurring horizontally, and rotating back:

fr[x,y,α]    rotα ⁣(fblur(rotα(I)))[x,y].f_r[x, y, \alpha] \;\propto\; \mathrm{rot}_{\alpha}\!\bigl(f_{\text{blur}}(\mathrm{rot}_{-\alpha}(I))\bigr)[x, y].

Restricting α\alpha to A\mathcal{A} halves the number of rotations: the image is rotated once for α=0\alpha = 0 and once for α=π/4\alpha = \pi/4; a horizontal box blur on each copy yields the integrals at {0,π/4}\{0, \pi/4\}, a vertical box blur yields the integrals at {π/2,3π/4}\{\pi/2, 3\pi/4\}.

Procedure

Algorithm
Localized Radon corner detection
Input: Grayscale image II; line half-length mm; response-smoothing half-size kk; response threshold τ\tau.
Output: Set of subpixel corner locations {(xi,yi)}\{(x_i^\ast, y_i^\ast)\}.
  1. Supersample II by a factor of two with bilinear interpolation to reduce aliasing in the rotated copies.
  2. Produce two rotated copies: I0=II_0 = I and Iπ/4=rotπ/4(I)I_{\pi/4} = \mathrm{rot}_{-\pi/4}(I).
  3. Apply a 1×(2m+1)1 \times (2m+1) box blur to each copy along xx and a (2m+1)×1(2m+1) \times 1 box blur along yy, producing four directional blurs corresponding to angles {0,π/2,π/4,3π/4}\{0,\, \pi/2,\, \pi/4,\, 3\pi/4\}.
  4. Rotate each blurred copy back to the original frame, obtaining fr[,α]f_r[\,\cdot\,,\,\alpha] for αA\alpha \in \mathcal{A}.
  5. Compute fc[x,y]=(maxαfrminαfr)2f_c[x, y] = (\max_\alpha f_r - \min_\alpha f_r)^2 pixelwise.
  6. Smooth fcf_c with a k×kk \times k box filter to suppress discretisation noise.
  7. Detect local maxima of the smoothed fcf_c; discard maxima with fc<τf_c < \tau and apply non-maximum suppression.
  8. Subpixel refinement: fit a Gaussian peak to fcf_c in a small neighbourhood of each retained maximum; downscale coordinates by two to undo the supersampling.
flowchart TB
    I["I"] --> S["2× super-<br/>sample"]
    S --> R0["rot α=0"]
    S --> R1["rot α=π/4"]
    R0 --> B0["1-D blur<br/>h &amp; v"]
    R1 --> B1["1-D blur<br/>h &amp; v"]
    B0 --> U["rotate back"]
    B1 --> U
    U --> C["f_c = (max−min)²"]
    C --> K["k×k smooth"]
    K --> N["local max + NMS"]
    N --> P["Gaussian peak fit"]

Implementation

The four-image combination in Rust, given the rotated-back directional blurs frf_r stacked plane-wise:

fn response_map(fr: [&[f32]; 4], n: usize) -> Vec<f32> {
    let mut fc = vec![0.0f32; n];
    for p in 0..n {
        let v = [fr[0][p], fr[1][p], fr[2][p], fr[3][p]];
        let mut lo = v[0];
        let mut hi = v[0];
        for &x in &v[1..] {
            if x < lo { lo = x; }
            if x > hi { hi = x; }
        }
        let d = hi - lo;
        fc[p] = d * d;
    }
    fc
}

fn line_integrals(i: &[f32], w: usize, h: usize, m: i32) -> [Vec<f32>; 4] {
    let r0 = i.to_vec();
    let r1 = rotate(i, w, h, -std::f32::consts::FRAC_PI_4);
    let bx0 = box_blur_h(&r0, w, h, m);
    let by0 = box_blur_v(&r0, w, h, m);
    let bx1 = box_blur_h(&r1, w, h, m);
    let by1 = box_blur_v(&r1, w, h, m);
    [
        bx0,
        by0,
        rotate(&bx1, w, h, std::f32::consts::FRAC_PI_4),
        rotate(&by1, w, h, std::f32::consts::FRAC_PI_4),
    ]
}

rotate is an affine resampler with bilinear interpolation about the image centre; box_blur_h and box_blur_v are separable (2m+1)(2m+1)-tap box filters evaluated with a running-sum to stay O(Ω)O(|\Omega|) independently of mm. The response map is the output of response_map applied to the four planes returned by line_integrals.

Remarks

  • Complexity: O(Ω)O(|\Omega|) per image. Rotations are O(Ω)O(|\Omega|) with bilinear sampling; box blurs are O(Ω)O(|\Omega|) via running sums; the per-pixel max/min over four values is constant work. Supersampling multiplies Ω|\Omega| by four.
  • The four-angle discretisation is justified by point symmetry: Rflocal[x,y,α]R_f^{\text{local}}[x, y, \alpha] at a true X-junction is a smooth, near-sinusoidal function of α\alpha with period π\pi, and the max/min separation is well approximated by sampling two orthogonal pairs {0,π/2}\{0, \pi/2\} and {π/4,3π/4}\{\pi/4, 3\pi/4\}. The approximation degrades when the junction's centreline angle falls midway between sample angles.
  • Kernel half-length mm encodes the expected radius of the corner support. Typical values are m{1,,4}m \in \{1, \dots, 4\} (i.e.\ 1×31 \times 3 to 1×91 \times 9 blurs). A mismatched mm either truncates the line integral inside a single sector (small mm) or crosses into neighbouring junctions (large mm).
  • The detector is noise-robust because box-filter sums of intensities attenuate additive image noise by a factor proportional to 2m+1\sqrt{2m+1}, whereas gradient-based detectors amplify the same noise through differentiation.
  • Skipping the 2×2\times supersample roughly doubles the subpixel error but roughly halves the runtime; the trade-off is linear in pixel count.
  • The response map also yields per-corner orientation: fitting a subpixel peak to fr[x,y,α]f_r[x^\ast, y^\ast, \alpha] over α\alpha recovers both centreline angles, which a downstream grid-growing step can use to seed neighbour search.
  • Compared with ChESS: see When to choose ChESS over Duda-Radon on the ChESS page, which hosts the comparison per the older-paper-hosts rule.

References

  1. A. Duda, U. Frese. Accurate Detection and Localization of Checkerboard Corners for Calibration. British Machine Vision Conference (BMVC), 2018. PDF
  2. E. D. Sinzinger. A model-based approach to junction detection using radial energy. Pattern Recognition, 2008. DOI: 10.1016/j.patcog.2007.06.032
  3. C. Harris, M. J. Stephens. A Combined Corner and Edge Detector. Alvey Vision Conference, 1988. DOI: 10.5244/c.2.23
  4. M. Rufli, D. Scaramuzza, R. Siegwart. Automatic detection of checkerboards on blurred and distorted images. IEEE/RSJ IROS, 2008. DOI: 10.1109/IROS.2008.4650703