@kubohiroya/turbowarp-camera-source 0.9.1 → 0.11.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 CHANGED
@@ -26,13 +26,13 @@ TurboWarp-Camera-Sourceは、MediaDevicesのカメラストリームを名前付
26
26
  次のURLをunsandboxed custom extensionとして読み込みます。
27
27
 
28
28
  ```text
29
- https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.9.1/dist/camera-source.js
29
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.11.0/dist/camera-source.js
30
30
  ```
31
31
 
32
32
  npm hostでは次を使います。
33
33
 
34
34
  ```bash
35
- pnpm add @kubohiroya/turbowarp-camera-source@0.9.1
35
+ pnpm add @kubohiroya/turbowarp-camera-source@0.11.0
36
36
  ```
37
37
 
38
38
  ## Quick start
@@ -69,10 +69,12 @@ stop shared camera [pose]
69
69
  - `camera device count`: 更新済みカメラデバイス数を返します。
70
70
  - `camera device ID at [INDEX]`: 1始まりの位置でカメラdevice IDを返します。
71
71
  - `camera device label at [INDEX]`: 1始まりの位置でカメララベルを返します。
72
- - `register camera profile [PROFILE_JSON]`: 内部校正プロファイルを検証して登録します。現行の`twcs/camera-intrinsics`と、旧`twrmc/camera-calibration`のどちらの文書も受け取ります。
72
+ - `register camera profile [PROFILE_JSON]`: 内部校正プロファイルを検証して登録します。校正アプリが書き出すROSの`camera_info` YAML(`turbowarp_camera_source`の項目付き)と、`twcs/camera-intrinsics`のJSON、旧`twrmc/camera-calibration`のJSONを受け取ります。
73
+ - `register camera profile [PROFILE_JSON] as [CAMERA_ID]`: 文書が持つcamera IDを指定したIDへ置き換えてから検証し、登録します。校正アプリで`default`として解いたプロファイルを`pose`として使う場合などに使います。camera profile errorの扱いは通常の登録ブロックと同じです。
73
74
  - `forget camera profile for [CAMERA_ID]`: 登録済みプロファイルを破棄します。
74
75
  - `camera [CAMERA_ID] is calibrated?`: プロファイルが登録されているかを返します。未登録は正常な状態です。
75
- - `camera profile JSON for [CAMERA_ID]`: 保存された文書をそのまま返します。表示や書き出し用であって、投影に使う数値ではありません。
76
+ - `camera profile JSON for [CAMERA_ID]`: 登録された文書を`twcs/camera-intrinsics`のJSONで返します。表示や保存用であって、投影に使う数値ではありません。ファイルとして渡すには`camera profile YAML`を使います。
77
+ - `camera profile YAML for [CAMERA_ID]`: 登録された文書をROSの`camera_info` YAMLで返します。ファイルへの書き出しやQRコードにはこの形を使います。標準の部分はROSやOpenCV系のツールがそのまま読み、`turbowarp_camera_source`の項目に適合判定に要る校正日時と撮影条件が入ります。
76
78
  - `camera profile error`: 直近の登録失敗のコードを返します。成功後は空文字列です。
77
79
  - `camera profile error detail`: 直近の登録失敗の位置と理由を返します。
78
80
  - `camera profile compatibility for [CAMERA_ID]`: `compatible`/`incompatible`/`undetermined`を返します。
@@ -81,6 +83,11 @@ stop shared camera [pose]
81
83
  - `camera intrinsics JSON for [CAMERA_ID]`: 現在のフレームに適合済みの内部行列を返します。適合していなければ空文字列です。
82
84
  - `camera conditions JSON for [CAMERA_ID]`: カメラが今報告している撮影条件を返します。
83
85
  - `camera conditions generation for [CAMERA_ID]`: 幾何に影響する条件が変わるたびに増える整数を返します。frame rateでは動きません。
86
+ - `save camera profile for [CAMERA_ID] to browser storage`: そのカメラに登録済みのプロファイルを、このoriginのブラウザストレージ(IndexedDB)へ保存し、同じoriginの他ウィンドウへ通知します。書き込み完了まで待ちます。結果は`saved`/`no-profile`/`unavailable`です。
87
+ - `restore stored camera profile for [CAMERA_ID]`: 保存済みプロファイルのうち、現在のカメラ構成に`compatible`な最新のものをこのcamera IDで登録します。fail closedで、`undetermined`や`incompatible`なものは登録せず、既存の登録にも触れません。結果は`restored`/`none`/`incompatible`/`undetermined`/`unavailable`です。
88
+ - `stored camera profile result for [CAMERA_ID]`: そのcamera IDで直近に行った保存または復元の結果を返します。未実行なら空文字列です。
89
+ - `stored camera profile detail for [CAMERA_ID]`: 直近の保存・復元の説明を返します。保存・復元したプロファイル、またはどの保存済みプロファイルもカメラに適合しない理由です。
90
+ - `stored camera profiles generation`: このウィンドウまたは同じoriginの他ウィンドウでプロファイルが保存されるたびに増えるカウンタです。プロジェクトを読み込んでも戻りません。
84
91
 
85
92
  <!-- END GENERATED BLOCKS -->
86
93
 
@@ -161,8 +168,87 @@ import type {CameraFrameSource, CameraLease} from "@kubohiroya/turbowarp-camera-
161
168
 
162
169
  **「判定できない」は「適合する」とは別の答え。** 適合性は`compatible`/`incompatible`/`undetermined`の3値で、不明が`compatible`へ格上げされることはない。プロファイルが現在の構成に適合していない限り内部行列は渡さない。渡してしまえば、利用側は別の構成の数値で投影し、**もっともらしく間違った幾何**を得ることになる。
163
170
 
171
+ ### 校正ファイル
172
+
173
+ PCの外へ出る校正(ファイルやQRコード)は、ROSの`camera_info` YAMLで書く。ROSの`camera_calibration_parsers`が読み書きする形式で、OpenCV系の処理、ROS/ROS 2のドライバ、SLAMツールがそのまま読める。`camera profile YAML for [CAMERA_ID]`は登録済みのプロファイルをこの形で返し、`register camera profile`はプロファイルJSONと同じようにこれを読む。
174
+
175
+ ```yaml
176
+ image_width: 1280
177
+ image_height: 720
178
+ camera_name: stage-left
179
+ camera_matrix:
180
+ rows: 3
181
+ cols: 3
182
+ data: [940.25, 0, 639.5, 0, 939.5, 359.5, 0, 0, 1]
183
+ distortion_model: plumb_bob
184
+ distortion_coefficients:
185
+ rows: 1
186
+ cols: 5
187
+ data: [-0.32, 0.11, 0.0002, -0.0003, -0.018]
188
+ rectification_matrix:
189
+ rows: 3
190
+ cols: 3
191
+ data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
192
+ projection_matrix:
193
+ rows: 3
194
+ cols: 4
195
+ data: [940.25, 0, 639.5, 0, 0, 939.5, 359.5, 0, 0, 0, 1, 0]
196
+ turbowarp_camera_source:
197
+ schema: "twcs/camera-intrinsics"
198
+ version: 1
199
+ profileId: "run-2026-09-15-a"
200
+ calibratedAt: "2026-09-15T04:05:06Z"
201
+ producer: "chessboard calibration"
202
+ undistorted: false
203
+ capture:
204
+ resizeMode: "none"
205
+ zoom: 1
206
+ focusMode: "manual"
207
+ quality:
208
+ sampleCount: 24
209
+ reprojectionErrorPx: 0.28
210
+ ```
211
+
212
+ **標準の部分はROSのキーと形そのままである。** 歪みモデルは、`brown-conrady`の5係数(4係数は`k3 = 0`を足して書く)⇔`plumb_bob`、8係数⇔`rational_polynomial`、`kannala-brandt`⇔`equidistant`と対応する。ROSには「歪みなし」のモデルが無いので、歪みの無い画像は5つの0の`plumb_bob`で書き、読むと`none`に戻る。
213
+
214
+ **ROSに置き場の無い情報は`turbowarp_camera_source`の下に入れる。** 校正日時、どの校正か、適合判定に使う撮影条件は、プロファイルがまだ使えるかを決めるのに要る。項目名はプロファイルのもので、撮影条件は`MediaTrackSettings`の名前である。ROSの読み込み処理はキーを名前で引くだけでこの項目を見ないので、ファイルはROSでもそのまま読める。この項目の無い素のROSファイルは`missing-field`で拒否する。校正日時を捏造すれば「分からない」が記録に化けるからである。
215
+
216
+ **読み込みはJSONと同じくfail closedである。** ほかのトップレベルのキー、単位行列でない平行化行列(ステレオの組のもの)、ビニングや切り出した関心領域、固定値の違う内部行列、ROSが定めていない係数の数は、該当する項目を示して拒否する。値そのものはJSONと同じ検証器を通る。読めるYAMLはyaml-cppとPyYAMLが書くもの(ブロックとフローのコレクション、引用符、コメント)で、アンカー、エイリアス、タグ、ブロックスカラー、複数文書は推測せずに拒否する。
217
+
218
+ 同じ規則を、TurboWarpの外のコード(校正アプリが書いたファイルを確かめるテストなど)のために関数として公開している。
219
+
220
+ ```ts
221
+ import {
222
+ readProfileText,
223
+ readCameraProfileDocument,
224
+ serializeCameraInfoYaml,
225
+ evaluateProfileCompatibility,
226
+ readCameraConditions
227
+ } from "@kubohiroya/turbowarp-camera-source/profile";
228
+ ```
229
+
230
+ ### ブラウザストレージ
231
+
232
+ プロファイルはブラウザ内に保持でき、次の作業や別ウィンドウでファイルを読み直さずに済む。`save camera profile for [CAMERA_ID] to browser storage`は登録済みプロファイルをIndexedDB(データベース`kubohiroya-camera-source`、object store`camera-profiles`、キーは`profileId`)へ書き込み、BroadcastChannel`kubohiroya-camera-source:camera-profiles`で保存を知らせる。`stored camera profiles generation`は、このウィンドウでも同じoriginの別ウィンドウでも保存のたびに増えるので、別ウィンドウの校正アプリを待つ作品はこの整数だけを見て、動いたら復元すればよい。
233
+
234
+ ```text
235
+ restore stored camera profile for [pose]
236
+ if <(stored camera profile result for [pose]) = [restored]> then
237
+ ... レンズ校正を省略 ...
238
+ ```
239
+
240
+ **これはキャッシュであってバックアップではない。** ストレージは1つのブラウザプロファイルの1つのoriginに属し、ホストやポートが違えば見えず、ブラウザが消すこともある。**書き出したプロファイルファイルが正本**なので、そちらを残しておくこと。
241
+
242
+ **復元はfail closedである。** 候補は`calibratedAt`の新しい順に、ブロックで指定したcamera IDへ付け替えたうえで、そのカメラの現在の構成と照合する。登録するのは`compatible`なものだけ。`undetermined`(たとえばカメラがまだフレームを届けていない)は弱いyesではなく、該当がなければそのカメラに登録済みのプロファイルはそのまま残る。結果は`restored`/`none`/`incompatible`/`undetermined`/`unavailable`、保存は`saved`/`no-profile`/`unavailable`を返す。
243
+
244
+ `register camera profile [PROFILE_JSON] as [CAMERA_ID]`はファイルに対して同じ付け替えを行う。校正アプリで`default`として解いたプロファイルを、利用側の作品で`pose`として登録できる。
245
+
164
246
  ## 互換性
165
247
 
248
+ 0.11.0では校正ファイルをROSの`camera_info` YAMLで読み書きするようにした。`camera profile YAML`を追加し、`register camera profile`はYAMLも受け取り、処理だけを持つ関数を`./profile`で公開した。既存のブロックとcapabilityのメンバーは変えていない。
249
+
250
+ 0.10.0では校正プロファイルのブラウザストレージと`register camera profile as`を追加した。既存のブロックとcapabilityのメンバーは変えていない。
251
+
166
252
  未リリースの変更は破壊的である。`CameraFrameSource.mirrored`は`previewFlip`へ置き換えた。軸を名指しでき、かつ「描画の話であって画素の話ではない」と言えるためである。previewブロックの`MIRRORED`引数は`PREVIEW_FLIP`へ置き換え、booleanはもう読まない。`acquireCamera`は`previewFlip`を受け取り、`mirrored`は受け付けない。frame sourceのinterfaceを手書きで持っている利用側は、公開した`./runtime`のimportへ移ること。そうしていればこの変更はビルド時に分かった。
167
253
 
168
254
  0.6.0ではcamera IDごとの開始失敗情報を公開し、inactive streamまたは終了したvideo trackを停止状態として
package/README.md CHANGED
@@ -30,13 +30,13 @@ or select separate cameras for separate roles.
30
30
  Load this URL as an unsandboxed custom extension:
31
31
 
32
32
  ```text
33
- https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.9.1/dist/camera-source.js
33
+ https://cdn.jsdelivr.net/npm/@kubohiroya/turbowarp-camera-source@0.11.0/dist/camera-source.js
34
34
  ```
35
35
 
36
36
  For npm hosts:
37
37
 
38
38
  ```bash
39
- pnpm add @kubohiroya/turbowarp-camera-source@0.9.1
39
+ pnpm add @kubohiroya/turbowarp-camera-source@0.11.0
40
40
  ```
41
41
 
42
42
  ## Quick Start
@@ -210,7 +210,7 @@ Returns the one-based camera device label at the requested index when the browse
210
210
 
211
211
  ### `register camera profile [PROFILE_JSON]`
212
212
 
213
- Validates a twcs/camera-intrinsics version 1 document and stores it against the camera it names. Nothing is stored unless the whole document passes, and the profile in force for that camera is replaced.
213
+ Validates a calibration and stores it against the camera it names. Accepts a ROS camera_info YAML file carrying the turbowarp_camera_source mapping, as the calibration app writes it, as well as twcs/camera-intrinsics version 1 JSON and the legacy twrmc/camera-calibration JSON. Nothing is stored unless the whole document passes, and the profile in force for that camera is replaced.
214
214
 
215
215
  | Property | Value |
216
216
  |---|---|
@@ -218,6 +218,17 @@ Validates a twcs/camera-intrinsics version 1 document and stores it against the
218
218
  | Opcode | `registerCameraProfile` |
219
219
  | `PROFILE_JSON` | String, default: `{}` |
220
220
 
221
+ ### `register camera profile [PROFILE_JSON] as [CAMERA_ID]`
222
+
223
+ Registers a profile under the named camera ID, replacing the ID the document carries before it is validated. Use it when a profile was solved under another name, such as `default` in a calibration app. Sets or clears the camera profile error like the plain register block.
224
+
225
+ | Property | Value |
226
+ |---|---|
227
+ | Type | Command |
228
+ | Opcode | `registerCameraProfileAs` |
229
+ | `PROFILE_JSON` | String, default: `{}` |
230
+ | `CAMERA_ID` | String, default: `default` |
231
+
221
232
  ### `forget camera profile for [CAMERA_ID]`
222
233
 
223
234
  Removes the stored calibration profile for one camera.
@@ -240,7 +251,7 @@ Reports whether a calibration profile is stored for the camera. An uncalibrated
240
251
 
241
252
  ### `camera profile JSON for [CAMERA_ID]`
242
253
 
243
- Returns the stored profile as JSON, or an empty string when the camera has none.
254
+ Returns the stored profile as twcs/camera-intrinsics JSON, or an empty string when the camera has none. For a file to hand to another machine or tool, use camera profile YAML.
244
255
 
245
256
  | Property | Value |
246
257
  |---|---|
@@ -248,6 +259,16 @@ Returns the stored profile as JSON, or an empty string when the camera has none.
248
259
  | Opcode | `cameraProfileJson` |
249
260
  | `CAMERA_ID` | String, default: `default` |
250
261
 
262
+ ### `camera profile YAML for [CAMERA_ID]`
263
+
264
+ Returns the stored profile as a ROS camera_info YAML document, or an empty string when the camera has none. This is the form to write to a file or show as a QR code: ROS and OpenCV-based tools read the standard part as it is, and the turbowarp_camera_source mapping carries the calibration time and camera settings compatibility needs.
265
+
266
+ | Property | Value |
267
+ |---|---|
268
+ | Type | Reporter |
269
+ | Opcode | `cameraProfileYaml` |
270
+ | `CAMERA_ID` | String, default: `default` |
271
+
251
272
  ### `camera profile error`
252
273
 
253
274
  Returns the code of the last rejected profile document, or an empty string when the last one was accepted.
@@ -326,6 +347,55 @@ Returns a number that increases whenever something affecting the geometry change
326
347
  | Opcode | `cameraConditionsGeneration` |
327
348
  | `CAMERA_ID` | String, default: `default` |
328
349
 
350
+ ### `save camera profile for [CAMERA_ID] to browser storage`
351
+
352
+ Saves the profile registered for the camera to this origin's browser storage (IndexedDB) and tells other windows on the same origin. Waits until the write commits. The result becomes `saved`, `no-profile` or `unavailable`.
353
+
354
+ | Property | Value |
355
+ |---|---|
356
+ | Type | Command |
357
+ | Opcode | `saveCameraProfile` |
358
+ | `CAMERA_ID` | String, default: `default` |
359
+
360
+ ### `restore stored camera profile for [CAMERA_ID]`
361
+
362
+ Registers the newest saved profile that is `compatible` with the camera as configured now, under this camera ID. Fails closed: an `undetermined` or `incompatible` profile is never registered and the current registration is left untouched. The result becomes `restored`, `none`, `incompatible`, `undetermined` or `unavailable`.
363
+
364
+ | Property | Value |
365
+ |---|---|
366
+ | Type | Command |
367
+ | Opcode | `restoreStoredCameraProfile` |
368
+ | `CAMERA_ID` | String, default: `default` |
369
+
370
+ ### `stored camera profile result for [CAMERA_ID]`
371
+
372
+ Returns the outcome of the last save or restore for the camera ID, or an empty string before either has run.
373
+
374
+ | Property | Value |
375
+ |---|---|
376
+ | Type | Reporter |
377
+ | Opcode | `storedCameraProfileResult` |
378
+ | `CAMERA_ID` | String, default: `default` |
379
+
380
+ ### `stored camera profile detail for [CAMERA_ID]`
381
+
382
+ Explains the last save or restore: which profile was saved or restored, or why no saved profile fits the camera.
383
+
384
+ | Property | Value |
385
+ |---|---|
386
+ | Type | Reporter |
387
+ | Opcode | `storedCameraProfileDetail` |
388
+ | `CAMERA_ID` | String, default: `default` |
389
+
390
+ ### `stored camera profiles generation`
391
+
392
+ A counter that increments whenever a profile is saved in this window or another window on the same origin. It is not reset by loading a project.
393
+
394
+ | Property | Value |
395
+ |---|---|
396
+ | Type | Reporter |
397
+ | Opcode | `storedCameraProfilesGeneration` |
398
+
329
399
  <!-- END GENERATED BLOCKS -->
330
400
 
331
401
  ## Runtime API
@@ -421,8 +491,121 @@ own repository and fails in a browser instead.
421
491
 
422
492
  **"Cannot tell" is a distinct answer from "fits".** Compatibility is `compatible`, `incompatible` or `undetermined`, and unknown never resolves upward. Intrinsics are withheld unless the profile actually fits the camera as configured now: handing them over regardless would let a consumer project with numbers from a different configuration and get plausible, wrong geometry back.
423
493
 
494
+ ### Calibration files
495
+
496
+ A calibration that leaves the PC — a file, or a QR code — is a ROS `camera_info` YAML document, the
497
+ format ROS's `camera_calibration_parsers` reads and writes and that OpenCV-based pipelines, ROS and
498
+ ROS 2 drivers and SLAM tools load as it is. `camera profile YAML for [CAMERA_ID]` renders the
499
+ registered profile that way, and `register camera profile` reads it back as well as profile JSON.
500
+
501
+ ```yaml
502
+ image_width: 1280
503
+ image_height: 720
504
+ camera_name: stage-left
505
+ camera_matrix:
506
+ rows: 3
507
+ cols: 3
508
+ data: [940.25, 0, 639.5, 0, 939.5, 359.5, 0, 0, 1]
509
+ distortion_model: plumb_bob
510
+ distortion_coefficients:
511
+ rows: 1
512
+ cols: 5
513
+ data: [-0.32, 0.11, 0.0002, -0.0003, -0.018]
514
+ rectification_matrix:
515
+ rows: 3
516
+ cols: 3
517
+ data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
518
+ projection_matrix:
519
+ rows: 3
520
+ cols: 4
521
+ data: [940.25, 0, 639.5, 0, 0, 939.5, 359.5, 0, 0, 0, 1, 0]
522
+ turbowarp_camera_source:
523
+ schema: "twcs/camera-intrinsics"
524
+ version: 1
525
+ profileId: "run-2026-09-15-a"
526
+ calibratedAt: "2026-09-15T04:05:06Z"
527
+ producer: "chessboard calibration"
528
+ undistorted: false
529
+ capture:
530
+ resizeMode: "none"
531
+ zoom: 1
532
+ focusMode: "manual"
533
+ quality:
534
+ sampleCount: 24
535
+ reprojectionErrorPx: 0.28
536
+ ```
537
+
538
+ **The standard part is ROS's, key for key.** Distortion models map as `brown-conrady` with five
539
+ coefficients (four are written with `k3 = 0`) ⇔ `plumb_bob`, eight ⇔ `rational_polynomial`, and
540
+ `kannala-brandt` ⇔ `equidistant`. A lens-free image is `plumb_bob` with five zeros, since ROS has no
541
+ model for none, and reads back as `none`.
542
+
543
+ **What ROS has no place for travels under `turbowarp_camera_source`.** When the camera was
544
+ calibrated, which run it was, and the capture settings compatibility is decided on are required to
545
+ tell whether a profile still fits; their member names are the profile's, and the capture members
546
+ are `MediaTrackSettings` names. ROS's reader looks keys up by name and ignores this one, so the file
547
+ still loads in ROS. A plain ROS file without it is refused with `missing-field`: inventing a
548
+ calibration time would turn "unknown" into a record.
549
+
550
+ **Reading fails closed, like JSON.** Other top-level keys, a rectification other than identity (a
551
+ stereo pair's), binning or a cropped region of interest, a calibration matrix whose fixed entries are
552
+ wrong, and a coefficient count ROS does not define are refused with the member that failed. The
553
+ values themselves then go through the same validator as JSON. The reader takes the YAML that
554
+ yaml-cpp and PyYAML write — block and flow collections, quotes, comments — and refuses anchors,
555
+ aliases, tags, block scalars and multiple documents rather than guessing.
556
+
557
+ The same rules are published as plain functions for code outside TurboWarp, such as a test that checks
558
+ a file a calibration app wrote:
559
+
560
+ ```ts
561
+ import {
562
+ readProfileText,
563
+ readCameraProfileDocument,
564
+ serializeCameraInfoYaml,
565
+ evaluateProfileCompatibility,
566
+ readCameraConditions
567
+ } from "@kubohiroya/turbowarp-camera-source/profile";
568
+ ```
569
+
570
+ ### Browser storage
571
+
572
+ A profile can be kept in the browser so the next session, or another window, does not need the file
573
+ again. `save camera profile for [CAMERA_ID] to browser storage` writes the registered profile to
574
+ IndexedDB (database `kubohiroya-camera-source`, object store `camera-profiles`, keyed by `profileId`)
575
+ and announces the save on the `kubohiroya-camera-source:camera-profiles` BroadcastChannel.
576
+ `stored camera profiles generation` moves on every save, in this window or any other on the same
577
+ origin, so a project waiting for a calibration app in another window watches one number and restores
578
+ when it changes.
579
+
580
+ ```text
581
+ restore stored camera profile for [pose]
582
+ if <(stored camera profile result for [pose]) = [restored]> then
583
+ ... skip lens calibration ...
584
+ ```
585
+
586
+ **It is a cache, not a backup.** Storage belongs to one origin in one browser profile, a different
587
+ host or port sees none of it, and the browser may evict it. The exported profile file stays the
588
+ source of truth; keep it.
589
+
590
+ **Restoring fails closed.** Candidates are tried newest `calibratedAt` first, each rebound to the
591
+ camera ID the block names and judged against that camera as it is configured now. Only a
592
+ `compatible` one is registered. `undetermined` — for example because the camera has not delivered a
593
+ frame yet — is not a weaker yes, and when nothing qualifies the profile already registered for the
594
+ camera is left as it was. The result is `restored`, `none`, `incompatible`, `undetermined` or
595
+ `unavailable`; a save reports `saved`, `no-profile` or `unavailable`.
596
+
597
+ `register camera profile [PROFILE_JSON] as [CAMERA_ID]` does the same rebinding for a file: a profile
598
+ solved under `default` in a calibration app can be registered as `pose` in the app that uses it.
599
+
424
600
  ## Compatibility
425
601
 
602
+ Version 0.11.0 writes and reads calibration files as ROS `camera_info` YAML: `camera profile YAML`
603
+ is new, `register camera profile` also accepts YAML, and the pure functions are published under
604
+ `./profile`. No existing block or capability member changes.
605
+
606
+ Version 0.10.0 adds browser storage for calibration profiles and `register camera profile as`. No
607
+ existing block or capability member changes.
608
+
426
609
  Unreleased changes are breaking. `CameraFrameSource.mirrored` is replaced by `previewFlip`, which
427
610
  names the axis and says that it describes the drawing rather than the pixels. The preview block's
428
611
  `MIRRORED` argument is replaced by `PREVIEW_FLIP` and the boolean is no longer read. `acquireCamera`
@@ -0,0 +1,32 @@
1
+ import type { CameraIntrinsicProfileV1, ProfileError } from './types.js';
2
+ /** The top-level key holding the members ROS has no place for. */
3
+ export declare const CAMERA_INFO_EXTENSION_KEY = "turbowarp_camera_source";
4
+ export type CameraInfoReadResult = {
5
+ readonly ok: true;
6
+ readonly document: Record<string, unknown>;
7
+ } | {
8
+ readonly ok: false;
9
+ readonly error: ProfileError;
10
+ };
11
+ /**
12
+ * Renders a profile as a ROS `camera_info` YAML document.
13
+ *
14
+ * The layout follows what `camera_calibration_parsers` writes, key for key and in the same order, so
15
+ * the file reads like one ROS produced. The projection matrix is the calibration matrix with a zero
16
+ * fourth column, which is what a monocular camera with no rectification has; binning and region of
17
+ * interest are left out, as ROS treats them as optional.
18
+ *
19
+ * Strings in the extra mapping are always double-quoted. A timestamp left plain is read as a date
20
+ * by YAML 1.1 readers such as PyYAML, and an id made only of digits as a number.
21
+ */
22
+ export declare function serializeCameraInfoYaml(profile: CameraIntrinsicProfileV1): string;
23
+ /**
24
+ * Turns a ROS `camera_info` YAML document into a profile document, ready to be validated.
25
+ *
26
+ * Only the shape ROS defines is checked here -- matrix sizes, the fixed entries of the calibration
27
+ * matrix, a rectification that does nothing, a distortion model ROS names. Everything the profile
28
+ * contract says about the values themselves is left to the profile validator, so there is one
29
+ * place that decides whether a calibration is acceptable.
30
+ */
31
+ export declare function readCameraInfoYaml(text: string): CameraInfoReadResult;
32
+ //# sourceMappingURL=camera-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camera-info.d.ts","sourceRoot":"","sources":["../../src/calibration/camera-info.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,wBAAwB,EAAmB,YAAY,EAAC,MAAM,YAAY,CAAC;AAGxF,kEAAkE;AAClE,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AA+BnE,MAAM,MAAM,oBAAoB,GAC5B;IAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAC,GAC/D;IAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;CAAC,CAAC;AAYvD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,MAAM,CA2CjF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAgBrE"}