# Bead: aerial-video-pose (Theo)

> **name:** `aerial-video-pose` — persona **Theo** (after the theodolite, the instrument that measures horizontal and vertical angles): the camera pose of every frame of aerial phone video (position, heading, pitch, roll, field of view, UTC time), with its provenance and uncertainty per frame.

## Produced — artifacts & deployments

| Surface | What it is | Kind |
|---|---|---|
| [verify page](https://redfish.acequia.io/guerin/.agents/01a0b360-28ed-7079-a389-dd94f425efb9/artifacts/n127bh-pose/verify/index.html) | the N127BH video beside a WebGL render of the terrain (ESRI imagery or BAER burn severity) from the solved pose; morph, side by side, difference; named peaks and the DEM skyline by calib.js; the calibration log's correspondences (skyline, SfM, image); mini-map with the view wedge; a timeline with channels (clips, provenance, rotation uncertainty, ADS-B fixes, narration, captions, heading with the ADS-B course, pitch, roll, look angle, residual) | app |
| [poses.json](artifacts/n127bh-pose/poses.json) · [poses.csv](artifacts/n127bh-pose/poses.csv) | **the per-frame pose file** (v2), 9,310 rows, with the clip table (UTC start and how the picture tested it, method, uncertainty, altitude bias, the independent checks, flags) | data |
| [repo/n127bh-verify/](repo/n127bh-verify/) · [commits on acequia-hub](https://redfish.acequia.io/acequia-hub/?bead=https://redfish.acequia.io/guerin/.agents/01a0b360-28ed-7079-a389-dd94f425efb9/) | the verify page's source under git (devops; commits authored by Debbie): main = nightly, tags = releases, production = the tagged tree; clone `repo/n127bh-verify/.git` | repo |
| [verify3d/](artifacts/n127bh-pose/verify3d/) | the verify page's **3D view**: the solved camera in TaosEngine (WebGPU) — `h` flies home into the frustum and holds the match, `p` projects the frame onto the terrain, orbit or fly; built from `repo/n127bh-verify/view3d/` against the pinned engine clone | app |
| [overlays/ beside the video](https://simtable.acequia.io/incidents/NM-SNF-FRIJOLES/n127bh-20260905-video/overlays/README.md) | the IMT's 5 Sep day-shift ops map as a Cloud-Optimized GeoTIFF (EPSG:3857, GoogleMapsCompatible, z15) + its neatline | data |
| [clips.json](artifacts/n127bh-pose/clips.json) | the nine clips: five scene cuts and four hidden ones found by the flow | data |
| [calibration note](2026-09-18/notes/calibration-log_k3v8q2nd.md) | how it was solved, what failed and why, every decision with its numbers | note |
| [calibration log](https://simtable.acequia.io/incidents/NM-SNF-FRIJOLES/n127bh-20260905-video/pose/calib-log/index.json) | append-only JSON Lines beside the video: every task, decision, pose, uv-uv and uv-geopoint pair, for replay | data |
| [pose/ beside the video](https://simtable.acequia.io/incidents/NM-SNF-FRIJOLES/n127bh-20260905-video/pose/README.md) | the large outputs: masks, KLT tracks, per-pair homographies, the calibration log | data |
| [repo/aerial-video-pose/](repo/aerial-video-pose/) | the code (Python + a Node harness around calib.js) | repo |
| [Nepal free-gauge viewer](https://redfish.acequia.io/guerin/.agents/01a0b360-28ed-7079-a389-dd94f425efb9/artifacts/nepal-free-gauge/index.html) | **the models and the camera poses** of the AFP Rasuwa helicopter video: sparse cloud, camera path and a frustum per keyframe, global bundle against chained, the keyframe slider showing the frame each camera saw. Dependency-free (2D canvas, no three.js). View state in the URL (`?shot=s08&kf=20`) | app |
| [gcprect.py](repo/aerial-video-pose/gcprect.py) · [the note](2026-09-22/notes/free-gauge-pose-and-georectification_6iqybbae6x.md) | **the free-gauge sizing study**: how many lat-lon to uv control points a relative-pose model needs, how accurate, and whether skewing helps (measured on S2a's own geometry) | note |

## Identity
- **name:** `aerial-video-pose` · **persona:** Theo · **aliases:** `theo`, `camera-pose` (registered with Oscar 2026-09-18)
- **URI:** https://redfish.acequia.io/guerin/.agents/01a0b360-28ed-7079-a389-dd94f425efb9/
- **GUID:** `01a0b360-28ed-7079-a389-dd94f425efb9` (UUIDv7)
- **Local origin:** `c:/Users/steph/Documents/sites/redfish.acequia.io/guerin/.agents/01a0b360-28ed-7079-a389-dd94f425efb9/`
- **Opened:** 2026-09-18
- **Hatched by:** Stephen — `start-bead aerial-video-pose camera-pose [ set name <persona> ... register the name with oscar ]` (verbatim in [the chat log](2026-09-18/chats/2026-09-18-hatch-and-s2-pose.md)); the persona placeholder came unfilled and the animating agent chose Theo (renameable)
- **Parent:** realtime-earth-system (Buck) [`01a097d6`](https://redfish.acequia.io/guerin/.agents/01a097d6-c2c4-7106-bace-40979b4ad0bc/about.md), whose [2026-09-17 handoff note](https://redfish.acequia.io/guerin/.agents/01a097d6-c2c4-7106-bace-40979b4ad0bc/2026-09-17/notes/handoff-n127bh-camera-pose_3oxub060.md) is this bead's brief
- **Mounts:** nick-weather [`01a07ec3`](https://redfish.acequia.io/guerin/.agents/01a07ec3-c19b-72e5-a577-9cf4a040201f/about.md) (calib.js, imported in place), tony [`c66cbd1d`](https://redfish.acequia.io/guerin/.agents/c66cbd1d-453c-41f8-8440-179502f25de4/about.md) (the engine), debbie [`c4a8e2f1`](https://redfish.acequia.io/guerin/.agents/c4a8e2f1-7b6d-4e93-a5c2-8f1d3b0e9a47/about.md) (timelines), BAER-Debris-Flow [`7c89a0b1`](https://redfish.acequia.io/guerin/.agents/7c89a0b1-3d2e-4f5a-9b6c-1e2f3a4b5c6d/about.md) (the BAER route)
- **Scribe:** CV — Claude Code (Opus 5), chat [`5ee7c132-b5ea-4b13-9b97-04d6e309b02e`](file:///C:/Users/steph/.claude/projects/c--Users-steph-Documents-sites/5ee7c132-b5ea-4b13-9b97-04d6e309b02e.jsonl)
- **Parciante:** Stephen Guerin (guerin) · **Visibility:** public

## Motivation (why a GUID)
Buck is an architect, not a builder; its handoff named a child bead as the alternative if the camera-pose work grew. It grew: a pipeline, a pose file, a verify page and a calibration log that later agents will replay. A GUID gives that work its own namespace, its own resume contract, and a name other beads can mount (the method generalizes to any aerial phone video with an ADS-B track).

## Mechanism (what this bead does)
Given a video, the aircraft's ADS-B track and the terrain, solve the camera pose of every frame:
1. **Masks**: the overlays no solve may look at (burned-in captions, window glare, the door post).
2. **Flow**: KLT tracks, per-pair homographies; where the tracks collapse are the hidden cuts; each clip gets one time offset.
3. **Four instruments**:
   - the frame's skyline against the DEM horizon from the eye (calib.js, twinned in Python to 0.00005°), trusted only where the sky is real sky (a sky mode per clip);
   - **image anchors**: the frame aligned to an ESRI-draped render (lit by the frame's sun, hazed by distance) on terrain-scale structure;
   - structure from motion over one second, metric from the ADS-B baseline, registered to the DEM. Its rotations proved biased 3 to 5°, so it only fills in;
   - DEM-anchored flow between frames (depth from the terrain, translation from the track).
4. **Time**: per clip, first from the registrations (the eye's along-track offset), the skyline or the turn anchor. Then **tested by the picture**: the image correlation over trial time offsets, and where there is sky, the time at which near terrain (image) and far ridges (skyline) agree on the rotation.
5. **Smoothing**: a sparse least-squares problem per clip combines everything; every frame carries what fixed it and a 1-sigma.
6. **Verification**: a render of the DEM draped with imagery or BAER burn severity from each frame's pose, beside or over the video. Three checks:
   - the skyline;
   - the image on held-out frames (midway between anchors);
   - the burned-versus-green pattern against the BAER map. It is the one reference that postdates the fire, so it is independent of the imagery.

## Folder layout
```
01a0b360-.../
├── about.md · README.md · agent.md · agent.json · names.json · keywords.json · bead-bind-startup.md
├── uploads/ · request/ · response/          the docks
├── artifacts/n127bh-pose/                  poses.json, poses.csv, clips.json, verify/ (the verify page), calib-log/ (small)
├── artifacts/nepal-free-gauge/             the free-gauge viewer, models.json, keyframe thumbnails
├── repo/aerial-video-pose/                 the code
└── YYYY-MM-DD/{chats,notes,skills}/     each session: the verbatim chat log and its notes
    ├── 2026-09-18/                          the calibration note
    └── 2026-09-22/                          the free-gauge design note and the Nepal test
```
Large outputs live beside the video: https://simtable.acequia.io/incidents/NM-SNF-FRIJOLES/n127bh-20260905-video/pose/

## Session log
- **2026-10-30** — T1 lane of the Norte recalibration (dispatched by Debbie): backup, gate (`js/gate/`), per-frame green/amber/red levels for all 69 clips, phase-3 priors, LoFTR+tracking+smoother pilot (`py/recal_clip.py`); c2092 v2 rejected by the gate, c7539 v2 gated. Results: [theo-recalibration-t1-results_t1r8w4kq.md](https://redfish.acequia.io/guerin/.agents/01a14b88-d846-7a67-b65f-fbc68e399d07/2026-10-29/notes/theo-recalibration-t1-results_t1r8w4kq.md).
- **2026-09-18** — hatched and registered (with `realtime-earth-system`/`buck` and `nick-weather`, which did not resolve in the registry). Masks for all 9,310 frames; four hidden cuts, nine clips; the calib.js twin; the altitude bias found (+140 to +200 m); the turn anchor at the start of S3a; structure from motion registered to the DEM; the S1 (Mitchell) clips placed in time; all nine clips solved; the pose file v1; the verify page v1. Then the quality pass: an image check showed v1's S3b 6° off (haze read as sky); sky modes; image anchors; an independent check against the BAER burn pattern; the SfM registrations' rotations found biased 3 to 5° and demoted; every clip's time tested by the picture (S2c's conflict resolved, the edit chronological); ADS-B jitter found; the pose file v2 with three checks per clip; the verify page's ADS-B, look-angle and residual channels. Made public on Stephen's word: anonymous read proved for every file, listing and page dependency; the synced Python bytecode cache removed. The verify page: a first visit opens on BAER morphed over the video, a return visit restores the visitor's state; the IMT's ops map as a drape from a COG made from its GeoPDF; the page's source under git per devops (`ask debbie`), commits on acequia-hub. **2026-09-20:** each pane gained a full-screen button and the right pane gained two navigable views — 3D in TaosEngine (`h` home into the frustum, `p` project the frame, orbit/fly) and 2D in MapLibre (terrain, the drapes, the track, the view wedge); v2.4.1. Chat [`5ee7c132`](file:///C:/Users/steph/.claude/projects/c--Users-steph-Documents-sites/5ee7c132-b5ea-4b13-9b97-04d6e309b02e.jsonl), [chat log](2026-09-18/chats/2026-09-18-hatch-and-s2-pose.md).

- **2026-09-22** — **a second line of work opened: the free-gauge case.** Stephen's ask: pose from interframe correspondences alone, georectified afterwards by lat-lon to uv correspondences, by a human translating/rotating/scaling the model, perhaps by skewing, and by image segmentation matched to GIS prior layers; the case being the Nepal flood video, where there is no ADS-B track and the DEM cannot be trusted. Worked out as a degrees-of-freedom ledger (SfM fixes everything except a 7-dof similarity, and drift, which is outside that family) and **measured** on S2a's own geometry with a new Monte Carlo, [gcprect.py](repo/aerial-video-pose/gcprect.py): 2,205 real ground points cast from 49 keyframes, a random gauge plus optional drift, control points carrying a real pick-plus-prior error budget. Findings: the knee is at **ten control points** (5.5 m map error at 2 px and 5 m priors, against 16.9 m at the minimum three and 2.6 m at forty); **losing the heights costs 12x** (66.8 m), which is the sharpest constraint on any vector-GIS route, and motivates the flood water surface as a free level-set datum; **drift sets a floor** control cannot lift (9 m mild, 35 m strong), so past ten points the problem is the model and not the control; and **skewing is the wrong cure** (an affine needs six points to be sane, is worse than a similarity whenever drift is absent, and degrades camera attitude 2 to 5x even where it wins on map error) with a bundle adjustment using the control as priors recommended instead. Note: [free-gauge-pose-and-georectification_6iqybbae6x.md](2026-09-22/notes/free-gauge-pose-and-georectification_6iqybbae6x.md); the staged plan is in [bead-bind-startup.md](bead-bind-startup.md). Nothing in the N127BH pose file or the verify page changed. Chat [`61c56ede`](file:///C:/Users/steph/.claude/projects/c--Users-steph-Documents-sites/61c56ede-8373-4a59-a170-fbf751d43d23.jsonl), [chat log](2026-09-22/chats/2026-09-22-free-gauge-pose-georectification.md).

- **2026-09-22 (second turn)** — **the free-gauge route tested on real footage with no priors at all.** Stephen: *"let's do a test on the nepal helicopter feed"*, the subject being Manav's Nepal pose bead [`01a0c093`](https://redfish.acequia.io/people/manav/.agents/01a0c093-bf9d-7b23-857b-1ce52506fce3/about.md) (read only; nothing written there). The video is in neither bead: it was re-fetched from [its YouTube source](https://www.youtube.com/watch?v=7t790a9WkWE) (AFP, 62.24 s, 1280x720, 25 fps, 1,556 frames, matching Manav's provenance note exactly). New code, all video-agnostic: [flowfree.py](repo/aerial-video-pose/flowfree.py) (Theo's flow stage freed of the N127BH video and its masks), [sfmfree.py](repo/aerial-video-pose/sfmfree.py) (incremental SfM in a free gauge, global bundle against chunk-chained, drift measurement), [run_nepal.py](repo/aerial-video-pose/run_nepal.py). Findings: **ten content shots, not the nine on record**, from nine zero-survivor cuts; **s09 and s10 have no parallax** (s09 accumulates 1 px of tracked motion over 160 frames, a locked-off slow zoom), which matters because s09 carries the confirmed Syabrubesi landmark and therefore cannot be solved by structure from motion at all; **the focal length is unobservable** (every start from 700 to 3400 px stays put, all sub-pixel) and **shape-changing** (f wrong by 2.6x moves camera attitude 44 degrees after the best similarity is removed), which adds a degree of freedom to the ledger that no similarity or affine can absorb afterwards; and **drift measured at 7 to 14 degrees of attitude and 9 to 19 degrees of bend** over a 5 second shot, stable across chunk size, against the 1 to 4 degrees the design note had assumed, which moves its map-error floor from 9-35 m to 105-234 m. Two of four shots reconstructed usably (s04, s08); s03 and s06 failed and are reported as failures. Also recorded: aligning two models on the camera trajectory is degenerate (a nearly collinear path pins only two of three rotational dof, and reported 159 degrees where the cloud-aligned answer was 6.5). Note: [nepal-free-gauge-first-test_swgihe4r7a.md](2026-09-22/notes/nepal-free-gauge-first-test_swgihe4r7a.md); viewer: [artifacts/nepal-free-gauge/](artifacts/nepal-free-gauge/index.html). The N127BH pose file, calibration log and verify page are untouched. Chat [`61c56ede`](file:///C:/Users/steph/.claude/projects/c--Users-steph-Documents-sites/61c56ede-8373-4a59-a170-fbf751d43d23.jsonl), [chat log](2026-09-22/chats/2026-09-22-free-gauge-pose-georectification.md).

- **2026-10-29** — **logged, not built: frame-to-frame intrinsics.** Stephen, from the Norte rop-house chat: did the batch use each helicopter's ADS-B, and track zoom (and a phone's lens switch) with SIFT plus optical flow. Answer recorded: yes, every airborne aircraft is a candidate eye per clip; 68 of 236 clips calibrated across eight aircraft, 164 matched none. Zoom today is a 4-dof KLT chain between 1 s keyframes; SIFT was tried only frame against render. Proposed: SIFT frame to frame, the rotation-plus-zoom homography decomposed directly, and intrinsics as a state with jumps for phone lens switches. Same day, widened to whole-frame matching (Fourier-Mellin / phase correlation, direct ECC alignment, dense flow, learned matchers), with H chosen over E/F by GRIC, since a kilometre-range eye has almost no baseline. Corrected the same day on Stephen's point that plumes and nearby aircraft break a homography: fit only the masked static ground with DEM depth (the existing KLT-to-DEM chain), label the independent motions by multi-model fitting, and use whole-frame methods only as seeds. Note: [frame-to-frame-intrinsics-sift-flow_r4k8w2pq.md](2026-10-29/notes/frame-to-frame-intrinsics-sift-flow_r4k8w2pq.md). Chat [`18dc48f9`](file:///C:/Users/steph/.claude/projects/c--Users-steph-Documents-sites/18dc48f9-3386-4f43-8f0b-c033df3c42b0.jsonl).

- **2026-11-10** — **Norte workflow critique (read-only).** Stephen asked for a review of the Norte reconstruction: are all constraints used for the 4D plume and the poses? Report: [theo-workflow-critique/index.html](https://redfish.acequia.io/guerin/.agents/01a14b88-d846-7a67-b65f-fbc68e399d07/2026-11-10/artifacts/theo-workflow-critique/index.html). In short, every published aerial pose holds ADS-B and the clock as hard truth, with no cross-clip or cross-camera relation. The plume uses 9 panoramas, with helicopters in one slice, cold-started slices and frozen poses. Ten recommendations, five of them Theo's: the trajectory and clock graph, relation seeds, the lens and landmark BA, the clips ledger, and v2 on all clips. Pointer: [2026-11-10/notes/norte-workflow-critique-pointer_t5q8w2nr.md](2026-11-10/notes/norte-workflow-critique-pointer_t5q8w2nr.md).
- **2026-11-11** — **Norte critique recommendations worked** (Stephen: "do what theo is recommending ... keep working"). In 2026-NorteFire skyfox-pose v0.7.1 to v0.12.0: the clips ledger (rec 4) and the workspace chip from it; `js/graph` (rec 3: ADS-B splines, broadcast clocks and rotations as one soft graph in JS; held-out error N93DD 5.76 -> 2.54 px, N50Q 9.16 -> 2.48; the FOX simulcast segment measured at +9.5 s; the c3162 miss is the pose, not the clock); relate.mjs and window C (rec 2: 0 credible absolute matches of 9 station clips, 42 relation seeds, SkyFOX 21:09:59 posed by relation from N71HD); a shared lens, landmarks, co-visibility, fire ties and the gate on held-out landmarks (recs 6 and 9: 10 -> 56 of 144 keyframes pass). Pointer: [2026-11-11/notes/norte-recs-shipped-pointer_p2h7x4dc.md](2026-11-11/notes/norte-recs-shipped-pointer_p2h7x4dc.md). Built here as a method: the N127BH todo "smooth the ADS-B track with velocities as soft constraints" now exists in JS.

## Modus operandi (how to interact)
- Read the pose file, open the verify page (`?f=<frame>&mode=side|blend|diff&drape=esri|baer|shade&sky=1&masks=1&corr=1`), or replay the calibration log.
- Ask for a clip re-solve or another video by a request in `request/` (the method needs: the video, an ADS-B or GPS track covering it, a DEM).
- Do not copy API keys into this bead: the renders use keyless ESRI, Terrarium and the public BAER tiles; Azure and Google keys stay where AnyHazard keeps them.

## Capabilities
- [calib.js](https://redfish.acequia.io/guerin/.agents/01a07ec3-c19b-72e5-a577-9cf4a040201f/repo/losalamos-weather/calib.js) (nick-weather), by import: the DEM skyline, the frame skyline, the pinhole
- [repo/aerial-video-pose/](repo/aerial-video-pose/): masks, flow, the Node harness, the calib.js twin, the skyline bank, the SfM-to-DEM registration, the smoother, the pose file, the renders

## Lifecycle
init (hatch, register) → setup (brief, mounts) → step (solve, verify, refine) → die only on Stephen's word; the resume contract is [bead-bind-startup.md](bead-bind-startup.md).

## Limitations
- **S4** is the weakest clip: 6 image anchors, little burn in view, no usable skyline. Its rotation sigma is 1.9°, and 57% of held-out frames are within 1.5°.
- **S1 (the Mitchell fire)** has no sky and is outside the BAER map. Its rotations rest on image anchors alone (σ 0.7 to 1.1°), checked only by the image on held-out frames (S1a 63% within 1.5°, S1b 100%).
- **S2c's time** (16:41:09 ± 3 s) comes from the near-far consensus and the chronology; its skyline alone still prefers 16:40:42, which overlaps S2b. It is flagged in the pose file.
- **Image-anchored rotations** map the frame onto the terrain from the stated eye, so they absorb part of the eye's error (0.6° measured in S2a). For the camera's true attitude, prefer the skyline-led clips (S2a, S2b, S5).
- **Position is the ADS-B track** (interpolated; its fixes jitter by up to about 80 m where the whole-second time stamps disagree with the reported speed) plus a per-clip altitude bias from the SfM registrations. It is not re-estimated per frame; σ is 36 to 168 m by clip.
- **The field of view is held at 61°** for every clip (fitted on S2a). The phone's stabilisation moves the principal point between frames, which a fixed pinhole absorbs as small rotations.
