@kubohiroya/turbowarp-camera-calibration 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +15 -6
- package/README.md +15 -6
- package/THIRD_PARTY_NOTICES.md +22 -5
- package/dist/camera-calibration.js +12107 -1970
- package/docs/architecture.ja.md +2 -2
- package/docs/architecture.md +2 -2
- package/docs/editor-schema-ci-fix-20261018.ja.md +38 -0
- package/docs/editor-schema-ci-fix-20261018.json +120 -0
- package/docs/editor-schema-profile-compat.json +30 -0
- package/docs/editor-schema-publication.ja.md +17 -0
- package/docs/editor-schema-publication.json +133 -0
- package/docs/editor-schema-verification.json +110 -0
- package/docs/editor-schema.ja.md +39 -0
- package/docs/index.html +48 -1
- package/docs/source-editor.ja.md +13 -0
- package/docs/stage-2-publication.ja.md +37 -0
- package/docs/stage-2-publication.json +91 -0
- package/lib/board/pattern.d.ts +7 -4
- package/lib/board/pattern.js +7 -4
- package/lib/calibration/distortion.d.ts +7 -0
- package/lib/calibration/distortion.js +8 -0
- package/lib/calibration/types.d.ts +12 -9
- package/lib/calibration/types.js +1 -8
- package/lib/runtime-capability.d.ts +5 -1
- package/lib-editor/schemas/camera-intrinsics-v1.schema.json +158 -0
- package/lib-editor/schemas/editor-legacy-input.json +60 -0
- package/lib-editor/src/calibration/distortion.d.ts +7 -0
- package/lib-editor/src/calibration/distortion.js +8 -0
- package/lib-editor/src/calibration/profile.d.ts +104 -0
- package/lib-editor/src/calibration/profile.js +392 -0
- package/lib-editor/src/editor-schema.d.ts +72 -0
- package/lib-editor/src/editor-schema.js +123 -0
- package/package.json +18 -8
- package/schemas/editor-legacy-input.json +60 -0
- package/src/block-definitions.json +1 -1
- package/src/board/pattern.ts +7 -4
- package/src/calibration/camera-source.ts +95 -9
- package/src/calibration/controller.ts +396 -78
- package/src/calibration/distortion.ts +21 -0
- package/src/calibration/measures.ts +94 -0
- package/src/calibration/opencv-backend.ts +97 -19
- package/src/calibration/opencv-symbols.ts +0 -1
- package/src/calibration/pose.ts +133 -38
- package/src/calibration/profile.ts +2 -2
- package/src/calibration/types.ts +12 -22
- package/src/calibration/worker-backend.ts +121 -13
- package/src/editor-schema.ts +148 -0
- package/src/extension.ts +5 -0
- package/src/runtime-capability.ts +5 -1
- package/src/source-editors.ts +30 -0
- package/schemas/extension-manifest.schema.json +0 -49
- package/src/extension-manifest.ts +0 -149
package/README.ja.md
CHANGED
|
@@ -74,6 +74,7 @@ whitelistでbuildし直し、10.9 MBから3.85 MBにしています。詳しく
|
|
|
74
74
|
| 板をサンプルごとに約20°〜45°、異なる向きへ傾ける | 正対した画像ばかりでは焦点距離と距離を分離できません。横へずらすだけでは足りず、傾けていない組は`sample-poses-degenerate`で拒否します |
|
|
75
75
|
| 距離を変え、画面の隅を含む別々の位置に板を写す | 歪みは画像中心から離れるほど大きく現れます。マーカーがコーナーに名前を与えるので、画面からはみ出した板も写っている分のコーナーを使えます |
|
|
76
76
|
| ピントを合わせ、少し止めて持つ | ぶれた画像は`sample-low-quality`で拒否するか、自動経路では`hold-steadier`と案内します |
|
|
77
|
+
| オートフォーカスを切り、カメラ自身の設定でピントを固定する | 連続オートフォーカスは板の動きに合わせて焦点距離を変えます。Camera Sourceはカメラの設定を読むだけで変更しないため、プロジェクトからは固定できません。ピントが動くと、その視点で`capture-condition-mismatch`になりセッションが終わります |
|
|
77
78
|
| セッション中に解像度・カメラdevice・左右反転・リサイズ・focus・zoomを変えない | セッションは開始時の条件に固定されます。変われば、カメラに合わないプロファイルを作る代わりに`capture-condition-mismatch`で終わります |
|
|
78
79
|
| 印刷板か1:1表示の画面を使い、プロジェクタは避ける | 台形補正、斜めからの投影、プロジェクタ自身のレンズ歪みが板を変形させ、しかも再投影誤差には現れません |
|
|
79
80
|
|
|
@@ -138,7 +139,7 @@ Node.jsやbuild環境を用意する必要はありません。専用buildのOpe
|
|
|
138
139
|
検証済みのversionをexact pinします。
|
|
139
140
|
|
|
140
141
|
```bash
|
|
141
|
-
pnpm add --save-exact @kubohiroya/turbowarp-camera-calibration@0.
|
|
142
|
+
pnpm add --save-exact @kubohiroya/turbowarp-camera-calibration@0.15.0
|
|
142
143
|
```
|
|
143
144
|
|
|
144
145
|
standalone bundle:
|
|
@@ -150,7 +151,7 @@ node_modules/@kubohiroya/turbowarp-camera-calibration/dist/camera-calibration.js
|
|
|
150
151
|
version固定CDN URL:
|
|
151
152
|
|
|
152
153
|
```text
|
|
153
|
-
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-calibration@0.
|
|
154
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-calibration@0.15.0/dist/camera-calibration.js
|
|
154
155
|
```
|
|
155
156
|
|
|
156
157
|
## クイックスタート
|
|
@@ -323,7 +324,7 @@ block referenceは
|
|
|
323
324
|
| `camera [CAMERA_ID] calibration reprojection error px` | Reporter | 直近のsolveまたは取り込んだプロファイルのRMS再投影誤差(px) |
|
|
324
325
|
| `camera [CAMERA_ID] calibration pose spread` | Reporter | 採用サンプルの傾きの広がり。0はすべて同じ向きで、solveできません |
|
|
325
326
|
| `camera [CAMERA_ID] calibration holdout error px` | Reporter | solveのfitに使っていないサンプルでのRMS再投影誤差(px) |
|
|
326
|
-
| `camera [CAMERA_ID] calibration holdout sample count` | Reporter |
|
|
327
|
+
| `camera [CAMERA_ID] calibration holdout sample count` | Reporter | 検証用に残したサンプルのうち、実際に検証できた数。0なら何も検証していません |
|
|
327
328
|
| `camera [CAMERA_ID] calibration error code` | Reporter | 依存・board・カメラ・サンプル・solve・再投影・プロファイル・登録の各エラーの安定コード |
|
|
328
329
|
| `camera [CAMERA_ID] calibration error` | Reporter | 詳細な診断メッセージ |
|
|
329
330
|
| `camera [CAMERA_ID] calibration profile JSON` | Reporter | 保存中の内部校正プロファイル。無い場合は空文字列 |
|
|
@@ -340,15 +341,23 @@ block referenceは
|
|
|
340
341
|
| 手動で、板が見つからない・別の板・ぶれている・既存サンプルと似すぎている | `board-not-found`、`wrong-board`、`sample-low-quality`、`sample-too-similar`で却下し、セッションはreadyのままです |
|
|
341
342
|
| 同じことが自動撮影中に起きた | エラーにせず、guidance reporterで次にすることを示します |
|
|
342
343
|
| 採用サンプルが40枚 | 手動では`sample-limit`。自動では最も他と似ている1枚を入れ替えます |
|
|
344
|
+
| 検出したコーナーが板上の一直線に並んでいる | 手動では`sample-low-quality`で却下し、自動ではguidanceで`show-the-board`を示します。そのようなビューからの姿勢計測は`board-pose-unavailable`です |
|
|
345
|
+
| ソルバーがframeまたはサンプル組を処理できなかった | `sample-failed`または`solve-failed`。セッションはサンプルとカメラを保ったままreadyに戻り、やり直せます |
|
|
346
|
+
| 自動撮影の1回の撮影が失敗し、セッションは続いている | エラーを記録して撮影を続けます。3回続けて失敗すると停止し、guidanceを空にします |
|
|
347
|
+
| ソルバーのworkerが応答しなくなった、またはWebAssemblyモジュールがabortした | 120秒で、またはworkerがエラーを報告した・モジュールがabortした時点で呼び出しを失敗させ、次の呼び出しで新しいworkerを起動します |
|
|
348
|
+
| 検証用に残した視点のうち、解いた結果で姿勢を求められたものが2つ未満 | 手動では確かめられなかったとして`reprojection-too-high`。自動撮影は収集を続けます |
|
|
349
|
+
| 自動撮影がsolve中に、手動でサンプル追加・solveした | サンプル追加はそのsolveが終わるまで却下します。solveはその完了を待ち、セッションが終わっていなければ改めて解いて自身の結果を返します |
|
|
343
350
|
| 傾けていない組でsolve | `sample-poses-degenerate`。セッションは開いたままでサンプルを追加できます |
|
|
344
351
|
| セッション中に解像度・device・左右反転が変わった | `resolution-mismatch` または `capture-condition-mismatch` |
|
|
345
|
-
|
|
|
346
|
-
| 再投影誤差が上限を超えた | `reprojection-too-high
|
|
352
|
+
| セッション中にリサイズ・ズーム・フォーカス・カメラが変わった | 次の視点で、またsolveを確定する前にも`capture-condition-mismatch`。camera-source がこのカメラに合わないと判定するプロファイルになるため、`solved` ではなく `error` で終わる |
|
|
353
|
+
| 再投影誤差が上限を超えた | `reprojection-too-high`。プロファイルは保存せず、サンプルを追加できます。手動のsolveも自動撮影と同じく、検証用に2視点以上残したときはfit側に加えてhold-out誤差を確かめます |
|
|
347
354
|
| 別のカメラ、または別の撮影サイズのプロファイル | 状態を変更する前に`calibration-not-applicable`で拒否します |
|
|
355
|
+
| プロファイルと異なるサイズのframe、またはCamera Sourceがプロファイルに合わないと判定するカメラで板の姿勢を測る | Camera Sourceの理由を添えて`calibration-not-applicable`。比較できない設定や、補正済み画像のプロファイルも含みます。計測せずにカメラを解放します。設定を記録していないプロファイル、または設定をまったく報告しないCamera Sourceでは、これまでどおり計測します |
|
|
348
356
|
| 校正の無いカメラ、または板が写っていない状態で姿勢を測る | `not-calibrated` または `board-pose-unavailable` |
|
|
349
357
|
| solve成功 | ただちにカメラのleaseを解放します |
|
|
350
|
-
| project停止・project再読込・runtime破棄 | すべてのセッションを取り消し、すべてのlease
|
|
358
|
+
| project停止・project再読込・runtime破棄 | すべてのセッションを取り消し、すべてのleaseを解放します。solveまたはimportしたプロファイルはプロジェクトではなくカメラを表すため、project停止・再読込では保持し、セッションの残っていないカメラは数値ごと`solved`のままです。runtime破棄とcleanupブロックで破棄します |
|
|
351
359
|
| 無効な入力 | セッション状態を変更する前に拒否します。boardを打ち間違えた再開始も、実行中のセッションを壊しません |
|
|
360
|
+
| `DICT_4X4_50`の50個を超えるマーカーが必要な板(例: 10×9は55個) | 最初のframeではなく開始時に`invalid-board`で拒否します |
|
|
352
361
|
|
|
353
362
|
共有カメラごとにセッション、プロファイル、診断を分けて保持します。あるカメラの
|
|
354
363
|
cancelが、別のカメラのleaseを解放したり、同じ共有カメラの他の利用者を止めたり
|
package/README.md
CHANGED
|
@@ -74,6 +74,7 @@ profile that carries a pairing credential is rejected rather than stored.
|
|
|
74
74
|
| Tilt the board roughly 20°–45° in different directions across samples | Views that are all fronto-parallel cannot separate focal length from distance. Sliding the board sideways does not help, and a set that was never tilted is refused as `sample-poses-degenerate` |
|
|
75
75
|
| Vary the distance, and fill different parts of the frame, including the corners | Distortion is strongest away from the image center. The markers name the corners, so a board that runs off the frame still contributes the corners it shows |
|
|
76
76
|
| Keep the board in focus and hold it still for a moment | A blurred view is refused as `sample-low-quality`, or the automatic path asks to `hold-steadier` |
|
|
77
|
+
| Lock the focus in the camera's own settings, rather than leaving autofocus on | Continuous autofocus moves the focal length as the board moves. Camera Source reads the camera's settings and never changes them, so this cannot be done from a project; a focus that moves ends the session at that view with `capture-condition-mismatch` |
|
|
77
78
|
| Do not change resolution, camera device, mirroring, resize mode, focus, or zoom during a session | The session is fixed to the conditions it started with; a change ends it with `capture-condition-mismatch` rather than a profile that does not fit the camera |
|
|
78
79
|
| Prefer a printed board or a 1:1 display; avoid projectors | Keystone correction, oblique projection, and the projector's own lens distort the board in ways the reprojection error does not show |
|
|
79
80
|
|
|
@@ -142,7 +143,7 @@ and is about 3.9 MB (about 1.5 MB gzip).
|
|
|
142
143
|
Install an exact version that you have reviewed:
|
|
143
144
|
|
|
144
145
|
```bash
|
|
145
|
-
pnpm add --save-exact @kubohiroya/turbowarp-camera-calibration@0.
|
|
146
|
+
pnpm add --save-exact @kubohiroya/turbowarp-camera-calibration@0.15.0
|
|
146
147
|
```
|
|
147
148
|
|
|
148
149
|
Load the standalone bundle from:
|
|
@@ -154,7 +155,7 @@ node_modules/@kubohiroya/turbowarp-camera-calibration/dist/camera-calibration.js
|
|
|
154
155
|
A version-pinned CDN URL is:
|
|
155
156
|
|
|
156
157
|
```text
|
|
157
|
-
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-calibration@0.
|
|
158
|
+
https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-calibration@0.15.0/dist/camera-calibration.js
|
|
158
159
|
```
|
|
159
160
|
|
|
160
161
|
## Quick start
|
|
@@ -559,7 +560,7 @@ Returns the RMS reprojection error over the samples the solve was not fitted to.
|
|
|
559
560
|
|
|
560
561
|
### `camera [CAMERA_ID] calibration holdout sample count`
|
|
561
562
|
|
|
562
|
-
Returns how many samples
|
|
563
|
+
Returns how many samples held back from the solve were validated: the ones a pose could be solved for with its answer. Zero means nothing was validated, so the holdout error says nothing.
|
|
563
564
|
|
|
564
565
|
| Property | Value |
|
|
565
566
|
|---|---|
|
|
@@ -620,15 +621,23 @@ Returns the last measured board pose as JSON, or an empty string when none was m
|
|
|
620
621
|
| Board not found, another board shown, blurred, or too similar to a kept view (by hand) | The sample is refused with `board-not-found`, `wrong-board`, `sample-low-quality`, or `sample-too-similar`, and the session stays ready |
|
|
621
622
|
| The same, during automatic capture | No error; the guidance reporter says what to do instead |
|
|
622
623
|
| 40 samples kept | By hand: `sample-limit`. Automatic: the view most like the others is replaced |
|
|
624
|
+
| A view whose corners lie on one line of the board | Refused as `sample-low-quality` by hand; the automatic path asks to `show-the-board`. A board pose from such a view is `board-pose-unavailable` |
|
|
625
|
+
| The solver fails on a frame or a set | `sample-failed` or `solve-failed`; the session stays ready with its views and its camera, so the step can be tried again |
|
|
626
|
+
| A look by automatic capture fails and the session survives it | Capture keeps watching and the error is recorded; after three failures in a row it stops and clears its guidance |
|
|
627
|
+
| The solver's worker stops answering, or its WebAssembly module aborts | The call fails after 120 s, or at once when the worker reports an error or the module aborts, and the next call starts a new worker |
|
|
628
|
+
| Views are held back but fewer than two of them can be posed with the solved answer | By hand: `reprojection-too-high`, because the answer could not be checked. Automatic capture keeps collecting |
|
|
629
|
+
| Sample or solve by hand while automatic capture is solving | A sample is refused until that solve ends. A solve waits for it and, unless it finished the session, solves as asked and reports its own result |
|
|
623
630
|
| Solve from a set that was never tilted | `sample-poses-degenerate`; the session stays open for more samples |
|
|
624
631
|
| Resolution, device, or mirroring changes mid-session | `resolution-mismatch` or `capture-condition-mismatch` |
|
|
625
|
-
| Resize mode, zoom, focus, or the camera changes
|
|
626
|
-
| Reprojection error exceeds the session limit | `reprojection-too-high`; no profile is stored and more samples can be added |
|
|
632
|
+
| Resize mode, zoom, focus, or the camera changes during the session | `capture-condition-mismatch` at the next view, and again before a solve lands; the session ends in `error` rather than `solved`, because Camera Source would judge the profile not to fit this camera |
|
|
633
|
+
| Reprojection error exceeds the session limit | `reprojection-too-high`; no profile is stored and more samples can be added. A solve by hand checks the hold-out error as well as the fit error, as automatic capture does, once at least two views were held back |
|
|
627
634
|
| Profile belongs to another camera or another capture size | `calibration-not-applicable`, rejected before any state changes |
|
|
635
|
+
| Board pose measured on a frame of another size than the profile, or on a camera Camera Source does not judge the profile to fit | `calibration-not-applicable` with Camera Source's reasons, including a setting it cannot compare and a profile of already undistorted images; nothing is measured and the camera is released. A profile that recorded no settings, or a Camera Source that reports none, is measured with as before |
|
|
628
636
|
| Board pose requested without a calibration, or with the board out of view | `not-calibrated` or `board-pose-unavailable` |
|
|
629
637
|
| Solve succeeds | The camera lease is released immediately |
|
|
630
|
-
| Project stop, project reload, runtime disposal | Every session is cancelled and every camera lease is released |
|
|
638
|
+
| Project stop, project reload, runtime disposal | Every session is cancelled and every camera lease is released. A solved or imported profile is kept across a project stop or reload, because it describes the camera rather than the project, and a camera with no session left stays `solved` with its numbers; runtime disposal and the cleanup block forget it |
|
|
631
639
|
| Invalid input | Rejected before any session state changes, including a restart with a mistyped board |
|
|
640
|
+
| A board needing more than the 50 markers of `DICT_4X4_50` (for example 10 by 9, which needs 55) | `invalid-board`, at the start rather than at the first frame |
|
|
632
641
|
|
|
633
642
|
Each shared camera has its own session, profile, and diagnostics. Cancelling one
|
|
634
643
|
camera never releases another camera's lease or stops another consumer of the
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
3
|
`dist/camera-calibration.js` is a standalone bundle. Everything it needs at run time is inlined,
|
|
4
|
-
including the components listed below.
|
|
4
|
+
including the runtime components listed below. The explicit `./editor-schema` entry also
|
|
5
|
+
depends on the first-party artifacts documented here; that entry is not inlined into the
|
|
6
|
+
extension bundle.
|
|
5
7
|
|
|
6
8
|
## OpenCV.js
|
|
7
9
|
|
|
@@ -33,16 +35,31 @@ version `4.4.2`, distributed under the Apache License 2.0.
|
|
|
33
35
|
|
|
34
36
|
The contract this extension talks to is imported from
|
|
35
37
|
[`@kubohiroya/turbowarp-camera-source`](https://github.com/kubohiroya/turbowarp-camera-source) at the
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
immutable Git artifact
|
|
39
|
+
`git+https://github.com/kubohiroya/turbowarp-camera-source.git#e11cc43ec35ff333bbefd50e8dcb461ee939c102`
|
|
40
|
+
(package version `0.17.0`), through its `./runtime` sub-entry: the camera lease, the runtime capability,
|
|
41
|
+
and the intrinsic profile document. That runtime entry contains declarations and a few string
|
|
42
|
+
constants; its built form imports nothing, so using this entry adds no camera controller or
|
|
43
|
+
device code to the bundle. The separate pure profile entry is described below. It is imported rather than copied because a
|
|
40
44
|
copy is checked against nothing: this repository's own hand-written copy named a registry method
|
|
41
45
|
Camera Source does not have, and every attempt to publish a profile failed for a reason that had
|
|
42
46
|
nothing to do with what the message said.
|
|
43
47
|
|
|
44
48
|
Camera Source is distributed under the Mozilla Public License 2.0.
|
|
45
49
|
|
|
50
|
+
Its pure `./profile` entry supplies calibration parsing and validation used by the runtime
|
|
51
|
+
bundle. Its `./editor-schema` entry supplies the shared profile Schemas used only by this
|
|
52
|
+
package's explicit editor entry and optional Source/Form registration.
|
|
53
|
+
|
|
54
|
+
## Extension Data Editor
|
|
55
|
+
|
|
56
|
+
The pure Schema engine and diagnostic helpers used by the explicit `./editor-schema` entry
|
|
57
|
+
and optional Source/Form registration
|
|
58
|
+
come from `@kubohiroya/turbowarp-extension-data-editor/schema`, at the immutable Git artifact
|
|
59
|
+
`git+https://github.com/kubohiroya/turbowarp-extension-data-editor.git#76fa1d50a3c188082ceef723ea018a9d8769ea6e`.
|
|
60
|
+
They do not introduce the RJSF UI into the runtime bundle. Extension Data Editor is distributed
|
|
61
|
+
under the Mozilla Public License 2.0.
|
|
62
|
+
|
|
46
63
|
## This extension
|
|
47
64
|
|
|
48
65
|
`@kubohiroya/turbowarp-camera-calibration` itself is distributed under the Mozilla Public License
|