Back to skills
SKILL.md
Calib Pattern Generator
ASecurityGenerate camera calibration-board vector PDFs: checkerboards, ChArUco, Kalibr/AprilGrid, symmetric and asymmetric circles. Use for 标定板、棋盘格、圆点标定板、ChArUco、AprilGrid or calib.io patterns. Ask for missing parameters first; prefer calib.io online generation and automatically fall back to local offline generation when unavailable.
- 11 stars
- 0 votes
- 0 copies
- 0 views
- Added November 9, 2026
Works with
Security analysis
100/100Pro scans all 3 files and shows the line behind each finding
npx -y skills add wangyendt/wayne-skills --skill calib-pattern-generator --agent claude-codeAre you the author of Calib Pattern Generator?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/wangyendt-calib-pattern-generator)---
name: calib-pattern-generator
description: "Generate camera calibration-board vector PDFs: checkerboards, ChArUco, Kalibr/AprilGrid, symmetric and asymmetric circles. Use for 标定板、棋盘格、圆点标定板、ChArUco、AprilGrid or calib.io patterns. Ask for missing parameters first; prefer calib.io online generation and automatically fall back to local offline generation when unavailable."
---
# 标定板生成
默认 **在线优先,无法访问时离线兜底**。在线通过 [calib.io](https://calib.io/pages/camera-calibration-pattern-generator) 网页在本机浏览器生成 PDF,不是云端生成 API;离线用 Python/ReportLab/OpenCV 独立生成矢量 PDF。
## 先补全参数
从用户请求和已确认上下文提取下表字段,统一尺寸为 **mm**。缺失时一次列出所缺字段及单位/选项,等用户补全;不得用网页默认值擅自填充。用户明确同意推荐值后才可使用。
| 字段 | 必填范围与含义 |
| --- | --- |
| `target` | `checker` 棋盘格 / `charuco` / `kalibr` AprilGrid / `circles` 对称圆点 / `circlesA` 非对称圆点 |
| `width`, `height` | 所有类型:整张板/PDF 页面的宽、高,不是图案包围盒 |
| `rows`, `columns` | 所有类型:行、列;棋盘/ChArUco 为方格数,AprilGrid 为 tag 数 |
| `spacing` | 所有类型:方格边长 / tag 边长 / 对称圆心间距 / 非对称对角圆心间距 |
| `dictionary`, `id`, `legacy` | ChArUco:`DICT_4X4` / `DICT_5X5` / `DICT_6X6` / `DICT_7X7`,起始 ID(可为 0),兼容模式 true/false(须确认) |
| `id` | AprilGrid:起始 ID |
| `diameter` | 两类圆点板:圆直径 |
- “9×6 棋盘格”未说明方格还是内角点时先问;明确为 9 列×6 行内角点才转换成 10 列×7 行方格。A4 未说明方向时询问横向/纵向。
- `circlesA` 行列是交错网格槽位,只在行列索引同奇偶时画圆,**不是 OpenCV 每行圆点个数**;不要直接照搬用户的 `patternSize`。
- ChArUco marker 边长固定 `floor(0.75*spacing)`,网页字典对应本地 OpenCV `DICT_NXN_1000`;检测端需匹配字典、ID、marker 尺寸和 legacy。
- AprilGrid 固定 36h11,黑边 2 模块,间隔比例 0.3,ID 从底行左侧逐行向上;本地无需另设字典/间隔。
## 运行
脚本路径相对于本 skill 目录解析。要求 Python 3.9+;缺少依赖时安装 `scripts/requirements.txt`。已有可用 `cv2.aruco` 时不要并装多个 OpenCV wheel 变体。在线需要 Playwright 浏览器:默认尝试 Chromium,再尝试已安装 Chrome;也可 `python -m playwright install chromium` 安装。
```bash
python <SKILL_DIR>/scripts/generate_pattern.py \
--target checker --width 200 --height 150 \
--rows 8 --columns 11 --spacing 15 \
--output /absolute/output/checker.pdf
```
以上是完整示例,不是缺省参数。JSON 配置可用 `--config /absolute/path/config.json`,字段名同上,`legacy` 必须为 JSON 布尔值;命令行值优先。
- 默认 `--backend auto`:先在线;网络超时、浏览器/依赖缺失、网页资源或下载不可用时,以**完全相同参数**生成离线版本。单步超时默认 15 秒,可 `--timeout` 修改。只尝试一次在线生成,不无限重试。
- `--backend calib.io`:强制在线,失败即报错;`--channel chrome` 可明确使用已安装 Chrome。
- `--backend offline`:强制离线,不联网、不启动浏览器;依赖预先装好后可完全离线生成。
- `--dry-run`:只校验参数,不联网、不生成;`--list-types`:列出类型。
- **缺参、非法尺寸、ID 越界、输出已存在、PDF 校验失败或网页参数契约变化时不自动兜底**,先解释错误让用户修正/排查,不能擅改参数或绕过校验。
- 默认输出当前目录 `calib-pattern.pdf`;已有文件不覆盖,除非用户明确同意使用 `--overwrite`。
stdout 为 JSON:`backend` 是实际使用的 `calib.io` 或 `offline`,`requested_backend` 是请求模式;自动兜底时还含 `fallback_reason` 和警告。交付时明确告诉用户实际模式、兜底原因,不把离线文件称为官网输出。`dry_run: true` 不表示已生成。退出码 0 成功、2 参数/业务校验错误、1 其他执行错误。
## 交付注意
- 返回 PDF 绝对路径链接、类型、页尺寸、图案尺寸、行列和专属参数;棋盘格附内角点列行 `(columns−1, rows−1)`。
- 提醒 **100% / Actual size 打印,关闭 Fit to page/缩放,打印后实测尺寸**。数字文件检查不等于实物打印精度验证。
- 官网说明生成器及输出仅供内部开发或教育,商业用途/转售须事先同意;使用官网模式前保留此提示。离线是独立实现,不使用官网脚本/字典/字体。
- 已用 8 对原始 PDF 验证样例布局与编码相符,4587 个字典编码逐 bit 一致;但官网深灰、本地纯黑,页脚/字体/PDF 结构不同,不承诺文件或像素完全相同,也不推广为任意参数与实物精度保证。
开发自检:仓库根目录运行 `python -m unittest discover -s tests/calib-pattern-generator -v`;完整 PDF 渲染/检测测试需额外安装 `pymupdf`,未安装时跳过该部分,不能声称它已验证。
Files in this skill
- SKILL.md
- scripts/generate_pattern.py
- scripts/requirements.txt
Attribution
Related skills
View all in tools →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.