# calibration-8k v0.3 (q4v9m2): the lens and the Boston geoid

Lane: calib8k, Ansel (01a16f0a) for BOS-Takeoff-Veillance (8ac6d87f), Claude Code chat ef1a66e3, 2026-10-25.
Stephen asked: "rerun the calibration with the lens parameter and boston geoid".
This note follows [calibration-8k_b8k3t5.md](calibration-8k_b8k3t5.md) (v0.2.1). Those files are unchanged; the player,
takeoff-3d and the ROP still read them. New files end in `_q4v9m2`.

## What changed, and what we found

1. **Geoid.** The Norte value came in at skyfox-pose `js/batch/tiles3d.mjs` lines 127, 149, 169 and 195. There, the eye
   for a Google 3D Tiles render is turned into ECEF with image-geo-projection's `NORTE_GEOID` (-35.5 m,
   `src/geodesy.js:66`). `node-io.mjs` builds the Terrarium DEM and the tiles surface with the same constant (lines 128
   and 142), and `geo.mjs:22` passes it to every `PinholeCamera`. Only the tiles path uses ECEF. All the other
   instruments (the drape, the coastline, the KLT transfer) work in MSL on a local tangent plane, where the geoid
   cancels. The ADS-B eye already used -28.6 m. So in v0.2 the tile renders saw the eye 6.9 m low.
   - v0.3 passes the tiles `hMsl + 6.9 m`, which puts the eye at hMsl - 28.6 m above the ellipsoid. No Norte file is
     edited.
   - `meta.geoid = -28.6`. The measurement lane reports about -28.2 m at Nahant. A geoid lookup along the track was not
     done: a few tenths of a metre is under 0.02 deg here (`meta.geoid_note`).
2. **One field of view per clip, for real.** This was the actual cause of the ROP's 0.984 scale and of its edge drift
   that flips sign at the image centre.
   - v0.2 gave the interframe ln-hfov terms a tiny sigma but kept their MEASURED deltas. So the field followed the
     KLT/AKAZE scale noise: 61.3 to 63.1 deg across 115634.
   - v0.3 sets the interframe hfov delta to 0, because the crop is constant (photo-sync). The field per clip is now
     62.18 deg (115634), 61.89 (115531) and 61.55 (115459).
3. **Lens.** `lensfit_q4v9m2.mjs` fits Brown-Conrady k1 and k2 jointly over 13 keyframes of all three clips (one camera
   mode). For each (k1, k2): undistort the frame, re-polish the pose on a wide 3D Tiles render (geoid-corrected eye),
   then measure 6x4 patch shifts against the render. The result, in `lens_q4v9m2.json`:
   - The radial component of the patch shifts crosses zero at **k1_0 = -0.0043 (1 sigma 0.023)** at the reference focal
     F0 = 1600 px per 1920 px of width. **k2 is not resolved** (held at 0). The global tile ZNCC peaks at k1 = 0.
   - At each clip's own focal (`meta.distortion`): **k1 = -0.0043, k2 = 0, p1 = p2 = 0, cx/cy = image centre**. That is
     at most ~2 px at the corners of a 1920 frame (~9 px at 8K).
   - Edge residuals: the edge-patch rms is 15.4 px with no lens. The fitted lens changes it by less than 0.2 px. The
     patch instrument's noise is about 10-12 px, so it cannot resolve a smaller lens.
   - **Verdict: no significant radial distortion.** The phone corrects its lens in-camera for 8K video. The term is
     carried in the files and the camera module so consumers have it, but the scale and drift error came from item 2.
4. **Pipeline.** Frames are undistorted before every instrument. The full-rate ADS-B eye and the photo-synced clocks are
   unchanged. The rest is as in v0.2.1: KLT every frame, AKAZE every keyframe, 3D-Tiles/coast/drape anchors, the joint
   adjustment and the held-out test.

## Results per clip, v0.2.1 (b8k3t5) to v0.3 (q4v9m2)

| clip | tiles anchors | held-out median / max (deg) | anchor residual median / max (deg) | coast check median (px at 1920) | interframe median (px) |
|---|---|---|---|---|---|
| 115634 | 69 to 69 | 0.058 / 0.161 to **0.068 / 0.117** | 0.073 / 0.382 to 0.058 / 0.217 | 4.91 to **4.51** | 0.093 to 0.078 |
| 115531 | 58 to **62/62** | 0.157 / 2.079 to **0.114 / 0.328** | 0.152 / 3.08 to 0.103 / 0.50 | 4.58 to 4.72 | 0.181 to 0.162 |
| 115459 | 5 to 8 | 1.19 / 7.53 to **0.54 / 2.98** | 0.83 / 3.55 to 0.42 / 2.91 | 5.71 to 6.41 | 0.61 to 0.52 |

## The ROP absolute test on Lynn Shore Drive, without the lock (`abs-test_q4v9m2.mjs`, `abs-test_q4v9m2.json`)

Setup:
- Frames: the 15 keyframes of 115634 that see the AOI (f150 to f570, 15:56:40 to :54Z).
- Each frame is projected onto the AOI grid at 0.5 m over the ROP's Google 3D Tiles DSM, through the poses alone.
- Each frame's ortho is registered to the ROP's Google true-ortho (`surface/base_0p5m.jpg`), 2 m then 1 m cells.
- "Before" reproduces the ROP's setup: v0.2.1 poses, camera.mjs, and the DSM in the v0.2 height frame.
- "After" uses the v0.3 poses, camera-distort_q4v9m2.mjs, and the DSM in true MSL (h_calib - 6.9 m).

| | median offset (m) | along road | across | along-road range over 14 s | spread |
|---|---|---|---|---|---|
| before (b8k3t5) | 9.4 | 9.3 | 1.7 | +1.1 to +24.4 | **23.3 m** |
| after (q4v9m2) | 12.0 | 10.9 | 5.0 | +7.6 to +18.0 | **10.4 m** |

- **The drift is less than half.** The 3D-Tiles-only instrument (2 m then 1 m cells) sees 23 m before, comparable to the
  ROP's -16 to +13 m. From f240 on it falls smoothly from 14 to 7.6 m.
- **The absolute offset is not removed.**
- Diagnosis (scratch `exp9.mjs`):
  - The constant along-road part behaves like an eye-position/timing error. At 2 km, 0.1 s of eye motion is about 4 m
    on the drive.
  - The 3D Tiles fits peak with the eye about **+0.12 s** later along track (z at f240/f330/f420/f510 is flat between
    0 and +0.3 s). That removes 3 to 4 m of the along-road offset.
  - The photo-sync clock for 115634 has 0.52 s spread between photos, and ADS-B timing has a few tenths of a second.
    So the remaining ~7-10 m sits within the time uncertainty but is not pinned by it.
  - Next step: solve one clock offset per clip jointly with the tiles anchors over all keyframes (a t0 scan as in Norte
    note 02), using the ROP's absolute registration as a check.

## 115459 f0 to f300 with the AAL1205 object anchors (track-object lane)

`calibrate_q4v9m2.mjs` accepts `OBJ_ANCHORS=<files>`. It uses only files whose review verdict is accepted, so AAL1205's
67 rows are used and EJA135 is skipped as rejected. Each frame's AAL1205 point gives a heading constraint with sigma
atan(20 m / range), about 2.4 deg. The shoreline gives pitch and roll at keyframes where it holds. Image anchors the
combination contradicts by more than 2 deg are dropped. Three to four passes were run.

**It does not converge.**
- AAL1205 alone fits its own pixel (median 1 px), but heading over f0-f66 swings 274 to 302 deg. With the shoreline
  added it still swings 275 to 303.
- The coast check at f90 and f120 gets worse (22 and 16 px, against 6.5 and 14 without).
- The drape/tiles anchors at f0 and f30 are themselves doubtful (coast 18 and 32 px).
- One aircraft cannot separate pitch from roll. The haze washes out the horizon, so my skyline detector found no line.
  The runway-edge instrument the coordinator suggested is not built yet.
- Delivered: the v0.3 run without object anchors. Its held-out error is 0.54 deg median and 2.98 max (v0.2.1: 7.5).
  The experiment is kept in scratch (`poses_115459_q4v9m2_aal-experiment.json`).
- **The human click-ask is still needed**: `clickask_115459_f0060_b8k3t5.jpg` and `.json`. A runway-edge chamfer on
  OSM runways 4R and 4L would be the automatic route.

## Files (artifacts/calibration-8k/)

- `poses_115634_q4v9m2.json`, `poses_115531_q4v9m2.json`, `poses_115459_q4v9m2.json`: schema **bos-calib8k-poses/2**.
  - It is /1 plus `meta.distortion` ({ model 'brown-conrady', k1, k2, p1 0, p2 0, cx 3840, cy 2160, image [7680, 4320],
    convention, k_at_reference_focal, source }), `meta.geoid -28.6`, `meta.geoid_note` and `meta.object_anchors`.
  - Row kinds add `anchor:object` and `anchor:coast-pr`; these occur only when OBJ_ANCHORS is set, so not in the
    delivered files.
  - The rows' hfov is the undistorted pinhole field. Project with the lens.
- `poses-index_q4v9m2.json` (schema bos-calib8k-poses-index/2), `calib-log_<clip>_q4v9m2.json`,
  `overlays_q4v9m2/<clip>_f*.jpg` (drawn on the undistorted frame; attribution burned in).
- `camera-distort_q4v9m2.mjs` is the projection helper. It has camera.mjs's exports and model, plus the lens (forward
  and iterative inverse for rays), `pixelOfEcef`, `pixelOfLlhEll` and `GEOID_M`.
  - Switch with a one-line import and pass `meta.distortion` as the 4th argument of `makeCamera`. Without it, the
    reference lens is scaled to the camera's focal.
  - Verified: identical to camera.mjs at k = 0, identical to image-geo-projection's PinholeCamera with k1/k2, and the
    ray inverse round-trips to 1e-13 px.
- Code: `calibrate_q4v9m2.mjs` (v0.3.1: 115634 and 115531 came from 0.3.0, which differs only by lacking the opt-in
  OBJ_ANCHORS path), `distort_q4v9m2.mjs`, `lensfit_q4v9m2.mjs` with `lens_q4v9m2.json`, `abs-test_q4v9m2.mjs` with
  `.json`, `lowanchors_q4v9m2.mjs` (object fit; the skyline fit did not work in haze), `make-index_q4v9m2.mjs`.
  The status note is `status-notes_q4v9m2.json`.
