A tool to generate chessboard patterns for OpenCV camera calibration
Project description
OpenCV Chessboard Generator
A Python tool to generate high-quality chessboard patterns for OpenCV camera calibration.
Features
- 🎯 Customizable grid dimensions (rows × columns)
- 📏 Configurable square size in centimeters
- 🖨️ Print-ready output with exact DPI settings
- 👁️ Preview before saving
- 📦 Easy to use Python API and CLI
Installation
Install from PyPI:
pip install opencv-chessboard-generator
Usage
Command Line Interface
After installation, run the interactive CLI:
chessboard-generator
Follow the prompts to specify:
- Number of inner corner columns (e.g., 6)
- Number of inner corner rows (e.g., 9)
- Square size in centimeters (default: 3.0)
- DPI resolution for printing (default: 300)
Python API
from chessboard_generator import ChessboardGenerator
# Create a chessboard with 6x9 inner corners, 3cm squares, 300 DPI
generator = ChessboardGenerator(rows=9, cols=6, square_size_cm=3.0, dpi=300)
# Save to file
generator.save("my_chessboard.png")
# Or preview before saving
generator.preview()
Recommended Settings for A3 Paper
For A3 paper (29.7 × 42 cm), we recommend:
- 13×8 inner corners (landscape orientation)
- Square size: 3.0 cm
- DPI: 300
generator = ChessboardGenerator(rows=8, cols=13, square_size_cm=3.0, dpi=300)
generator.save("chessboard_a3.png")
Printing Instructions
⚠️ IMPORTANT: For accurate camera calibration, print settings matter!
- Print at EXACTLY the specified DPI (no scaling)
- Disable "Fit to page" in print settings
- Use 100% scaling
- Mount the printed chessboard on a flat, rigid surface
- Measure the printed squares to verify they match your specified size
OpenCV Integration
After generating your chessboard, use it with OpenCV:
import cv2
# For a 6×9 inner corners chessboard
pattern_size = (6, 9)
square_size = 3.0 # cm
# Find chessboard corners in your calibration images
ret, corners = cv2.findChessboardCorners(image, pattern_size)
Requirements
- Python >= 3.7
- OpenCV >= 4.5.0
- NumPy >= 1.19.0
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development
For development setup and automated releases with GitHub Actions, see:
Author
Batuhan ÖKMEN (batuhanokmen@gmail.com)
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_chessboard_generator-1.0.7.tar.gz.
File metadata
- Download URL: opencv_chessboard_generator-1.0.7.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78d201ac7c976bac7e2c26127a431481f648738ffa671af6b673f59456611b5e
|
|
| MD5 |
a3098392a787731ee386a7779cfbf0c4
|
|
| BLAKE2b-256 |
73aa471117d4acdacfd251391e6796d23f7dad333c45daf400d5eb0792a2149c
|
File details
Details for the file opencv_chessboard_generator-1.0.7-py3-none-any.whl.
File metadata
- Download URL: opencv_chessboard_generator-1.0.7-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9ce3e013246e86b2b076669b012364367e68528ca4cd66b82116601b3fe6da5
|
|
| MD5 |
ee8c1e5a7fabccdc58a85cfff1e6d2cd
|
|
| BLAKE2b-256 |
1de6c04bebe950ffee6abfd161ff173aa788dd2cbe5a49631cf35b82bac6d07b
|