Audit OpenCV checkerboard calibration datasets, detect weak or duplicate views, visualize image-plane coverage, calibrate the camera, and generate an explainable offline report.
Project description
OpenCV Calibration Audit
Audit OpenCV checkerboard calibration datasets, detect weak or duplicate views, visualize image-plane coverage, calibrate the camera, and generate an explainable offline report.
This package provides a production-quality, installable tool to inspect and validate checkerboard image datasets used for monocular camera calibration with OpenCV. It's designed to be a reliable quality gate in computer vision and robotics pipelines.
The main differentiator of this tool is its focus on dataset quality analysis, explainable rejection reasons for bad images, and comprehensive reporting, rather than just being a minimal wrapper around cv2.calibrateCamera().
This project is intended to complement the opencv-chessboard-generator package.
Key Features
- Dataset Validation: Checks for consistent image resolutions, sufficient image counts, and readable files.
- Checkerboard Detection: Uses
cv2.findChessboardCornersSBfor robust corner detection. - Image Quality Metrics: Measures sharpness, board geometry, exposure, and perspective.
- Dataset-Level Analysis: Analyzes field-of-view coverage, pose diversity (scale, orientation), and detects near-duplicate images.
- Camera Calibration: Performs a standard pinhole camera calibration.
- Explainable Results: Provides clear, structured reason codes for every rejected or flagged image.
- Rich Reporting: Exports results to JSON, YAML, CSV, and a self-contained HTML report.
- CLI and Python API: Usable as both a command-line tool and a Python library.
Installation
pip install opencv-calibration-audit
Quick Start
Run an audit on a directory of calibration images with the following command:
calibration-audit analyze ./calibration_images \
--cols 9 \
--rows 6 \
--square-size 30 \
--unit mm \
--output ./audit_result
Important Convention: Inner Corners
The --cols and --rows arguments always refer to the number of inner corners on the checkerboard, not the number of squares.
For a 10x7 checkerboard (10 squares by 7 squares), the number of inner corners is 9x6.
+---+---+---+---+
| ● | ● | ● | ● | <-- 4x3 inner corners
+---+---+---+---+
| ● | ● | ● | ● |
+---+---+---+---+
| ● | ● | ● | ● |
+---+---+---+---+
Python API Usage
from pathlib import Path
from calibration_audit import AuditConfig, PatternSpec, audit_dataset
# This is a future-state example; audit_dataset is not yet implemented in Phase 1
# config = AuditConfig(
# pattern=PatternSpec(
# cols=9,
# rows=6,
# square_size=30.0,
# unit="mm",
# ),
# min_valid_images=12,
# )
# result = audit_dataset(
# image_directory=Path("./calibration_images"),
# config=config,
# )
# print(result.summary)
# result.write_outputs(Path("./audit_result"))
Limitations (MVP)
The initial version focuses on monocular, pinhole camera calibration with standard checkerboards. The following are explicitly excluded from the MVP:
- Stereo, fisheye, or multi-camera calibration
- ChArUco, ArUco, or circle-grid targets
- Live camera capture or GUI interfaces
Development
To set up a development environment:
# Clone the repository
git clone https://example.com/your-repo.git
cd opencv-calibration-audit
# Install in editable mode with dev dependencies
pip install -e .[dev]
# Run tests
pytest
# Run linters and type checkers
ruff check .
mypy .
CI/CD
- Pushes and pull requests run Ruff, Mypy, Pytest, a build check,
twine check, and a CLI smoke test in GitHub Actions. - After CI passes on
main, GitHub Actions automatically bumps the patch version, commits it back tomain, creates and pushes a tag, and then publishes the release. - Pushing a version tag that starts with
vcreates a GitHub Release and publishes the package to PyPI through Trusted Publishing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file opencv_calibration_audit-0.1.0.post9.tar.gz.
File metadata
- Download URL: opencv_calibration_audit-0.1.0.post9.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a5491d758055eb86e50fe56f712553049524475aad078339209cf381dcfa818
|
|
| MD5 |
efc472823a953d425ecdd7f64d8f8731
|
|
| BLAKE2b-256 |
b2fbf04931af0991ed0da87839a926365cbd6280f8cd0bc55868ed926e491d61
|
Provenance
The following attestation bundles were made for opencv_calibration_audit-0.1.0.post9.tar.gz:
Publisher:
release.yml on flavvesResearch/opencv-calibration-audit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opencv_calibration_audit-0.1.0.post9.tar.gz -
Subject digest:
5a5491d758055eb86e50fe56f712553049524475aad078339209cf381dcfa818 - Sigstore transparency entry: 2290659343
- Sigstore integration time:
-
Permalink:
flavvesResearch/opencv-calibration-audit@2b7fda0f7c5607fd42bd7b01f1439b90bcaa4b92 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/flavvesResearch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b7fda0f7c5607fd42bd7b01f1439b90bcaa4b92 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file opencv_calibration_audit-0.1.0.post9-py3-none-any.whl.
File metadata
- Download URL: opencv_calibration_audit-0.1.0.post9-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbadddfdf37898d7e2d659c8b94502ab09ab0ba48345608ea10c238311448d97
|
|
| MD5 |
24e88d666faf1f4a48ae2c97e05a467b
|
|
| BLAKE2b-256 |
2ffb2da9dec7049d8a65278253534f16add464240a2eb0168f6e3f51fe5f970a
|
Provenance
The following attestation bundles were made for opencv_calibration_audit-0.1.0.post9-py3-none-any.whl:
Publisher:
release.yml on flavvesResearch/opencv-calibration-audit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opencv_calibration_audit-0.1.0.post9-py3-none-any.whl -
Subject digest:
fbadddfdf37898d7e2d659c8b94502ab09ab0ba48345608ea10c238311448d97 - Sigstore transparency entry: 2290659390
- Sigstore integration time:
-
Permalink:
flavvesResearch/opencv-calibration-audit@2b7fda0f7c5607fd42bd7b01f1439b90bcaa4b92 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/flavvesResearch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2b7fda0f7c5607fd42bd7b01f1439b90bcaa4b92 -
Trigger Event:
workflow_run
-
Statement type: