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)

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).

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.1.1.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

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

chess_corners-0.1.1-cp310-abi3-macosx_11_0_arm64.whl (244.5 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: chess_corners-0.1.1.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for chess_corners-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8246f02520cb1af2f05e162bae71a9565a0b45c9fa3ec4b8c05b8ea9f1e75894
MD5 f4330b8974fe74fc459e1bfefdfc5649
BLAKE2b-256 7daf7158b059c5e18e2f9052b96498098a8954c20329216c1ad1a80252a0ae7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chess_corners-0.1.1-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f22907340ebfecfa97459f68d3c3eceeaaba927f5595fe57b5932fabacf2f66
MD5 91d7e01cf1d93e79524226e977471cb3
BLAKE2b-256 a6f19c8c4bf9d27f52432883bbfc31d3739bb2ae026285b6ce786862882ba7f0

See more details on using hashes here.

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