Skip to main content

Python bindings for the fast ChESS chessboard corner detector (Rust backend)

Project description

chess_corners (Python)

Python bindings for the chess-corners detector.

Quick start

import numpy as np
import chess_corners

img = np.zeros((128, 128), dtype=np.uint8)

cfg = chess_corners.ChessConfig()
cfg.threshold_rel = 0.2
cfg.min_cluster_size = 1

corners = chess_corners.find_chess_corners(img, cfg)
print(corners.shape, corners.dtype)

You can also configure the detector via nested config objects:

cfg = chess_corners.ChessConfig()
cfg.params.threshold_rel = 0.2
cfg.multiscale.pyramid.num_levels = 2

What find_chess_corners returns

find_chess_corners(image, cfg=None) returns a NumPy float32 array of shape (N, 4) with columns:

  1. x – subpixel x coordinate (pixels, image space)
  2. y – subpixel y coordinate (pixels, image space)
  3. response – ChESS response strength at the corner
  4. orientation – local grid axis orientation in radians, in [0, pi)

The rows are sorted deterministically by the binding: response (descending), then x, then y.

Input requirements:

  • image must be a 2D uint8 NumPy array with shape (H, W)
  • it must be C-contiguous (non-contiguous arrays raise ValueError)

ChessConfig parameters

ChessConfig mirrors the most important Rust settings. Defaults match the Rust ChessConfig::default().

Response / detector parameters (cfg.*):

  • use_radius10 (bool, default False)
    • Use the larger ring radius (r=10) instead of r=5 for response computation.
  • descriptor_use_radius10 (Optional[bool], default None)
    • Override the descriptor sampling ring radius; when None, uses use_radius10.
  • threshold_rel (float, default 0.2)
    • Relative threshold as a fraction of the max response.
  • threshold_abs (Optional[float], default None)
    • Absolute threshold; when set, it overrides threshold_rel.
  • nms_radius (int, default 2)
    • Non-maximum suppression radius in pixels.
  • min_cluster_size (int, default 2)
    • Minimum count of positive neighbors in the NMS window to accept a corner.

Multiscale parameters (cfg.*):

  • pyramid_num_levels (int, default 3)
    • Number of pyramid levels (including base). Set to 1 for single-scale.
  • pyramid_min_size (int, default 128)
    • Minimum dimension to keep building the pyramid.
  • refinement_radius (int, default 3)
    • Coarse-level ROI radius used for coarse-to-fine refinement.
  • merge_radius (float, default 3.0)
    • Merge near-duplicate refined corners within this radius (pixels).

Full configuration structs

The Python bindings expose all configuration structs directly. You can use the nested API for clarity:

  • ChessConfig.paramsChessParams
  • ChessConfig.multiscaleCoarseToFineParams
  • CoarseToFineParams.pyramidPyramidParams

All fields listed above are available in the nested structs as well.

Classical refiners

Select the classic refiner via ChessParams.refiner:

cfg = chess_corners.ChessConfig()
cfg.params.refiner = chess_corners.RefinerKind.forstner(
    chess_corners.ForstnerConfig()
)

Available configs:

  • CenterOfMassConfig
  • ForstnerConfig
  • SaddlePointConfig

ML refiner

If the bindings are built with the ml-refiner feature, an ML-backed refiner is available via find_chess_corners_with_ml:

cfg = chess_corners.ChessConfig()
corners = chess_corners.find_chess_corners_with_ml(img, cfg)

The ML refiner uses built-in defaults and ignores the model’s confidence output in the current version.

Development

maturin develop -m crates/chess-corners-py/pyproject.toml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chess_corners-0.4.0.tar.gz (793.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

chess_corners-0.4.0-cp310-abi3-win_amd64.whl (5.9 MB view details)

Uploaded CPython 3.10+Windows x86-64

chess_corners-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

chess_corners-0.4.0-cp310-abi3-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file chess_corners-0.4.0.tar.gz.

File metadata

  • Download URL: chess_corners-0.4.0.tar.gz
  • Upload date:
  • Size: 793.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for chess_corners-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e4dc2ce1173c0027c511cbbeb4ab60d4c7fa74f7c3b35f2c1b49804d8bb396f8
MD5 e4ec8abbf24d20a9e2a082f8915bb0d5
BLAKE2b-256 bfd37faa2fed8c63e0bd61286b693206ab409a72b327cc226e9053f63b21f84b

See more details on using hashes here.

Provenance

The following attestation bundles were made for chess_corners-0.4.0.tar.gz:

Publisher: release-pypi.yml on VitalyVorobyev/chess-corners-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chess_corners-0.4.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for chess_corners-0.4.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 49a2780c52f81d6cb37c7ede1ec61315c414e4c57b1fc48a48d2befdd2e4c7ae
MD5 b72d36bd923e655cc5320e8e4897542e
BLAKE2b-256 20e2987ce8bc5553b5e98c41455e813ab09d9af375d807ade8292bc8268b7401

See more details on using hashes here.

Provenance

The following attestation bundles were made for chess_corners-0.4.0-cp310-abi3-win_amd64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/chess-corners-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chess_corners-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chess_corners-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f9770ea863b5970776da2b9df11969249f93966f62967e0ad6b204e947f2e715
MD5 e10e3e27377f5379ff8087a29e78f6a3
BLAKE2b-256 9ff1272b9a9a1a135949967668924110df02c1ac1ee0cdd813e908776f98523a

See more details on using hashes here.

Provenance

The following attestation bundles were made for chess_corners-0.4.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/chess-corners-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file chess_corners-0.4.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for chess_corners-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b80c2382eef0ece4c8cf52a49fb16aca68bde590505409c8dd9ebd00140ce7c
MD5 91e8e90370d1dd593824fa4deba906fe
BLAKE2b-256 79a7a44d28d4264b3230cb01c6b75775f9a9c1de21628ec669244271dbd464dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for chess_corners-0.4.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on VitalyVorobyev/chess-corners-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page