# calibration-8k (b8k3t5): per-frame camera pose of the three 8K window clips

Lane: calib8k, Ansel (01a16f0a) for BOS-Takeoff-Veillance (8ac6d87f), Claude Code chat ef1a66e3, 2026-10-24/25.
Code and outputs: `artifacts/calibration-8k/` (all new files end in `_b8k3t5`). Nothing synced. No existing file of the bead was edited.

## Result

| clip | UTC (t0 from photos) | frames | status | anchors (keyframes ~1 s) | held-out | coast check |
|---|---|---|---|---|---|---|
| 115634 (Lynn, Swampscott, Marblehead, Salem) | 15:56:35.159 to 15:57:44.0 | 2060 | **solved** | 69/69 Google 3D Tiles | median 0.06 deg, max 0.16 | median 4.9 px |
| 115531 (Chelsea Creek, Revere, Rumney Marsh, Lynn) | 15:55:31.639 to 15:56:33.5 | 1852 | **solved** (one weak stretch, below) | 58 tiles, 1 coast, 1 drape | median 0.16 deg, max 2.1 (the f660 coast anchor) | median 4.6 px |
| 115459 (runway 4R roll, climb past Constitution Beach) | 15:54:59.476 to 15:55:16.8 | 515 | **partly solved** | 5 tiles, 3 coast, 3 drape, 7 none | f330 on ~1 deg; f0-f300 not verified | f330 on ~5 px |

The held-out figure is the angle between a keyframe anchor that was left out (every 4th) and the joint solution without it.
The coast check is independent: the OSM shoreline cast through the final pose against the water edge found in the frame,
median distance in px at 1920 wide (x4 for 8K px). It includes the OSM high-water line against the surf on beaches, so a few
px of it are not pose error. Overlays (OSM coastline red, major roads yellow, water edge cyan, attribution burned in):
`overlays_b8k3t5/<clip>_f<frame>.jpg`.

Weak stretches, by the files' own `sigma_deg` column and the caveats in each `summary.caveats`:
- 115531: f1800 to f1851 (the last 2 s) are carried by the flow from the f1770 anchor; f660 and f720 had coast and drape
  anchors that disagree with the flow by 2-3 deg (the joint solution follows the flow there).
- 115459: f0 to f300 (15:54:59.5 to 15:55:09.6, the roll and the rotation, eye 10 to 200 m) are rough: the anchors at that
  height are weak or contradict each other (held-out 7.5 deg at f180) and KLT lost 92 of 514 pairs to motion blur.
  A human keyframe is asked for: `clickask_115459_f0060_b8k3t5.jpg` with `.json` (6 numbered landmarks: the AAL1205 A321
  taxiing at its ADS-B position, the Chelsea Street Bridge towers, the east end of Constitution Beach, the 22R threshold
  bars, the Tobin Bridge, the Zakim towers). Two of the coordinates are marked approximate.

## Pose files (schema `bos-calib8k-poses/1`, as posted on the bus)

`poses_<clip>_b8k3t5.json` = `{ schema, meta, rows, keyframes, summary }`, index `poses-index_b8k3t5.json`.
- `meta`: clip, video and proxy URIs, `t0_utc` and `t0_source`, `frame_count`, image 7680x4320, `pose_pane` [1920, 1080],
  camera (pinhole, principal point at the centre, no distortion; hfov is the full horizontal field in deg, resolution
  independent), conventions (heading deg clockwise from true north of the optical axis; pitch deg, up +; roll deg, + is
  clockwise seen from behind: image-geo-projection's PinholeCamera), `columns`, `column_notes`, `eye`, `hfov_model`,
  `references` (OSM, Esri, Google 3D Tiles attribution), code version.
- `rows`: one per video frame: `[f, t_s, utc, lat, lon, alt_m, heading, pitch, roll, hfov, kind, anchor_px, inter_px, sigma_deg]`.
  `f` 0-based; `t_s` the frame pts from the clip start (the clips are slightly variable rate); `alt_m` MSL;
  `kind` is `anchor:tiles|anchor:coast|anchor:drape` on held keyframes, `keyframe:flow` on unheld keyframes, else `flow`;
  `anchor_px` the coast check on keyframes; `inter_px` the interframe residual (px at 1920) against the previous frame;
  `sigma_deg` a 1-sigma rotation estimate (0.15 deg at an anchor, +0.1 deg per second from the nearest anchor).
- `keyframes`: per keyframe the scores of every instrument at the anchor and at the final pose, the anchor, drape and
  final poses, and the anchor residual of the joint solution.
- `summary`: counts, medians, the held-out list, `status`, `caveats`.

## Method

Stephen's ask, as relayed: interframe feature matches and optical flow, then calibration against geolocations, solved jointly.

1. **Frames.** 1920x1080 proxies and the 1 fps keyframes of my own (GPU decode, `_scratch/bos-calib8k/`), every 30th
   frame as a keyframe; the coordinator's 960x540 proxies (`media/proxy-960/`, same frame count) for the flow. Frame
   times from the original's packet pts.
2. **Clock** (`photo-sync_b8k3t5.mjs`). The phone stamps a video with its start second (filename) and its end second
   (CreateDate), so the start was known to about 1 s. The photos taken during recording are wider crops of the same
   sensor stream (scale 1.22 to 1.25) with millisecond EXIF times: each was matched to the video frames (scaled-crop grey
   ZNCC, sub-frame peak). t0 = filename second + 0.476 s (115459), + 0.639 s (115531), + 1.159 s (115634), spread 0.16 to
   0.52 s between photos. The constant crop also says the 8K field does not change, hence one hfov per clip.
3. **Eye** (`eyetrack_b8k3t5.mjs`). A smoothing spline (0.5 s nodes, acceleration penalty) through the full-rate adsb.lol
   readsb trace of a0b846 (`adsb/release-20261024-full_v5k2m8qt/raw/`, ~1 s fixes; ADS-B geometric height minus geoid
   -28.6 m) and the 15 photo GPS fixes (a 2.0 s horizontal lag solved by a scan). Before the trace arrived the eye came
   from OpenSky + photos, and the heights on the early climb were 100 to 180 m too LOW (the phone's vertical fix lags on a
   20 m/s climb). That was the main cause of the earlier failures at 115459 and 115531 f0-f660; with the trace, 115531 went
   from 26 to 58 tile anchors and 115634's held-out median from 0.13 to 0.06 deg. The loader swaps sources by a file
   (`BOS_TRACE=<file>|none`).
4. **Seed.** 115634 k30: skyfox-pose `search.mjs searchEye` (the drape panorama, coarse sweep, fine ZNCC), checked by the
   coastline on its overlay. 115531 k61: AKAZE across the 1 s gap from 115634 f0 (`link_b8k3t5.mjs`). 115459 k17: the same
   global search, once the eye was right (z 0.28, a clear first; it had failed with the low eye).
5. **Keyframe walk** (`calibrate_b8k3t5.mjs`). From the seed, keyframe to keyframe: AKAZE matches (opencv.js 4.10 WASM;
   this build has no SIFT), the relative pose by skyfox-pose `calibrate.mjs transferPose` (rotation and focal with the eye's
   known motion taken out by DEM depth: H = K2 R K1^-1 in the far-field limit), then the geo anchor at the keyframe, in
   this order of preference:
   - **tiles**: Google Photorealistic 3D Tiles rendered from the eye (skyfox-pose `view.mjs renderView`, `viewSolve`:
     band-passed ZNCC; buildings and real terrain), held at z >= 0.15 within 3 deg of the flow;
   - **coast**: OSM coastline, piers and ponds cast through the pose, a chamfer fit to the frame's water edge;
   - **drape**: Esri World Imagery on the Terrarium DEM (sea clamped to 0 m), skyfox-pose `geo.mjs fineSolve`.
6. **Every frame**: KLT (Shi-Tomasi + pyramidal Lucas-Kanade, forward-backward check, RANSAC gate) between consecutive
   960 frames, relative pose by `transferPose` from the interpolated keyframe poses.
7. **Joint adjustment** (`calib8k-lib_b8k3t5.mjs jointAdjust`): every frame's heading, pitch, roll and ln hfov by least
   squares over the KLT terms (sigma floor 0.03 deg a frame), the AKAZE keyframe terms (0.08 deg) and the anchors (tiles
   0.1, coast 0.12, drape 0.3 deg); hfov held constant per clip. Anchors are never taken alone; the residual of each is
   reported. Held-out: every 4th anchor left out and the solve repeated.

Window mask: dark pixels connected to the border (the cabin wall and window frame) and 14 px around them.

## Credentials and terms

Google 3D Tiles (approved by Stephen tonight) through skyfox-pose `node-io googleTilesNode`, which reads the Node
server key from `.credentials/api-keys/google-apis.json`. The coordinator named the `maps-browser` key, but its registry
metadata says "Browser key: do not use from Node (no Referer)", so I used the server key the Norte lane already uses for
the same call. Neither value is written anywhere. Tile bytes and renders stay in memory; the Google attribution is in each
pose file's `meta.references` and burned into the overlays. Esri tiles (keyless, the Norte loader) are cached in OS scratch
only. OSM via Overpass (`fetch-osm_b8k3t5.mjs`, ODbL).

## Comparison runs

`poses_115634_coast-v010_b8k3t5.json` is the first 115634 solve (coast and drape anchors, per-frame hfov, OpenSky eye):
held-out 0.19 deg, coast check 6.0 px. Adding the tiles (v0.2.0, still the old eye) took held-out to 0.13 deg. The
trace (v0.2.1) took it to 0.06 deg.

## Limits

- No lens-distortion model. Far corners, beyond about 14 km, can be off by 10 to 30 px at 1920.
- The eye is ADS-B geometric height with one constant geoid. Rolling shutter is not modelled; the flow absorbs it.
- 115459 below about 200 m is rough. KLT drops out in the roll's motion blur and the anchors disagree.

## Next

1. A human clicks `clickask_115459_f0060_b8k3t5.jpg`. Then `search.mjs resect` from the eye and
   `calibrate_b8k3t5.mjs 115459 2 '<pose>'`. Or point the taxiing aircraft (AAL1205, JBU23, JBU917, EJA135, all with
   ADS-B) as automatic point anchors.
2. Per-frame 8K refinement where the viewer zooms: the poses are 1920-based but resolution independent.
3. A one-parameter radial distortion solved jointly over all keyframes of 115634.

Files: `calibrate_b8k3t5.mjs` (driver), `calib8k-lib_b8k3t5.mjs`, `calib8k-node_b8k3t5.mjs`, `features_b8k3t5.mjs`,
`eyetrack_b8k3t5.mjs`, `photo-sync_b8k3t5.mjs` with `.json`, `seed_b8k3t5.mjs`, `seedtiles_b8k3t5.mjs`,
`seedtiles-grid_b8k3t5.mjs`, `coastgrid_b8k3t5.mjs`, `link_b8k3t5.mjs`, `osmmap_b8k3t5.mjs`, `overlay_b8k3t5.mjs`,
`clickask_b8k3t5.mjs`, `make-index_b8k3t5.mjs`, `fetch-osm_b8k3t5.mjs` with `osm_b8k3t5/`, `seeds_b8k3t5/`,
`overlays_b8k3t5/`, `calib-log_<clip>_b8k3t5.json`. Reused in place: skyfox-pose `js/batch` (geo, search, calibrate
transferPose, view, node-io, node-pool), `js/egp`, image-geo-projection (`01a14cef`).
