chess-corners
Ergonomic ChESS (Chess-board Extraction by Subtraction and Summation) detector on top of
chess-corners-core.
This crate:
- Re-exports the main types from
chess-corners-core(ChessParams,CornerDescriptor,ResponseMap). - Provides a unified
ChessConfigfor single-scale and multiscale detection. - Exposes
PyramidParamsfor tuning pyramid construction viaCoarseToFineParams. - Adds optional
image::GrayImageintegration and a small CLI binary for batch runs. - Exposes pluggable subpixel refiners (
RefinerKindviaChessParams::refiner) so you can choose between center-of-mass (default), Förstner, or saddle-point refinement.
Examples
By default the image feature is enabled so you can work directly with GrayImage:
use ;
use Reader as ImageReader;
Selecting a refiner
The default refiner matches the legacy center-of-mass behavior. To opt into the Förstner or saddle-point refiners on image intensities:
use ;
let mut cfg = single_scale;
cfg.params = default;
let refiner = Forstner;
cfg.params.refiner = refiner;
let corners = find_chess_corners_image;
You can also override the refiner per call without mutating your config via
find_chess_corners_image_with_refiner.
ML refiner (feature ml-refiner)
Enable the ML-backed refiner (feature ml-refiner) to run the exported ONNX model in Rust:
use ;
use GrayImage;
let mut cfg = single_scale;
cfg.params = default;
let img = new;
let corners = find_chess_corners_image_with_ml;
The ML refiner runs an ONNX model on normalized patches (uint8 / 255.0) centered
on each candidate and predicts [dx, dy, conf_logit]. The current version
ignores conf_logit and applies the offsets directly, using the embedded model
defaults (patch size and batch size are fixed to match the model).
Current evaluation is synthetic; real-world performance still needs validation.
It is also slower (about 23.5 ms vs 0.6 ms for 77 corners on testimages/mid.png).
You can also try the bundled examples on sample images in testimages/:
- Single-scale:
cargo run -p chess-corners --example single_scale_image -- testimages/mid.png - Multiscale:
cargo run -p chess-corners --example multiscale_image -- testimages/large.png
Both examples require the image feature, which is enabled by default. If you build with --no-default-features, re-enable it when running examples: --features image.
Feature flags:
image(default) – enablefind_chess_corners_imageforimage::GrayImage.rayon– parallelize response computation and multiscale refinement.ml-refiner– enable ML entry points and ONNX inference viachess-corners-ml.simd– enable portable-SIMD acceleration in the core response kernel (nightly only).par_pyramid– opt into SIMD/rayonin the pyramid builder.tracing– emit structured spans from multiscale detection and the CLI when enabled.
The full guide-style documentation and API docs are published at:
- Book: https://vitalyvorobyev.github.io/chess-corners-rs
- Rust docs: https://vitalyvorobyev.github.io/chess-corners-rs/api/
Python bindings are available in this workspace under crates/chess-corners-py
and are published as the chess_corners package on PyPI.