agentleFS
wangyendtwangyendt/wayne-skills/calib-pattern-generator/SKILL.md

calib-pattern-generator

Skill9 starsChanged 9 months agoMITView on GitHub

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.

The file

Files
SKILL.md

标定板生成

默认 在线优先,无法访问时离线兜底。在线通过 calib.io 网页在本机浏览器生成 PDF,不是云端生成 API;离线用 Python/ReportLab/OpenCV 独立生成矢量 PDF。

先补全参数

从用户请求和已确认上下文提取下表字段,统一尺寸为 mm。缺失时一次列出所缺字段及单位/选项,等用户补全;不得用网页默认值擅自填充。用户明确同意推荐值后才可使用。

字段必填范围与含义
targetchecker 棋盘格 / charuco / kalibr AprilGrid / circles 对称圆点 / circlesA 非对称圆点
width, height所有类型:整张板/PDF 页面的宽、高,不是图案包围盒
rows, columns所有类型:行、列;棋盘/ChArUco 为方格数,AprilGrid 为 tag 数
spacing所有类型:方格边长 / tag 边长 / 对称圆心间距 / 非对称对角圆心间距
dictionary, id, legacyChArUco:DICT_4X4 / DICT_5X5 / DICT_6X6 / DICT_7X7,起始 ID(可为 0),兼容模式 true/false(须确认)
idAprilGrid:起始 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 安装。

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,未安装时跳过该部分,不能声称它已验证。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.