# takeoff-player v0.3.0: track object (t7k4m9xq)

Lane: player, Ansel, for BOS-Takeoff-Veillance (8ac6d87f), 2026-10-25. Follows [takeoff-player-fixed-view_q6k1qlhs.md](takeoff-player-fixed-view_q6k1qlhs.md) (v0.2.0).
Stephen: *"lets add an option to track a moving object that we have telemetry for like the airplanes."*
Edited: `artifacts/takeoff-player/` only, plus five new files in `artifacts/calibration-8k/anchors/` (no calibration file touched; `artifacts/rop/` not touched).

Open (AAL1205, the A321 taxiing beside the takeoff roll, found in every frame it is in):
https://stephenguerin.live/agents/8ac6d87f-3192-4fdb-a260-583dbee74291/artifacts/takeoff-player/index.html?track=AAL1205
Then press **prefetch 8K** (about 70 s the first time, then the frame service cache answers in a second or two) and play.
Other links: `?track=N9871K` (GA at 10 km, 115634), `?track=EJA135`, `?track=<icao|callsign|reg>&clip=<clip>&t=<s>`.

## What it does

- **Choose the object**: click an aircraft label (or its ring) on the video, or the **track** list (the aircraft predicted
  in frame in this clip, nearest first, with their frame span), or `?track=`. Without `?clip=` the page goes to the clip that
  sees the object most and to the start of its span. Esc or × stops; T opens the list; P prefetches.
- **Predict** (`js/track.mjs`): the object's position at the frame's UTC, cubic Hermite on the trace (tangents from the
  neighbouring fixes; linear across gaps over 5 s), projected through that frame's pose by `camera.mjs`, the same model
  as the labels (hold field applies). The size prior comes from the type (length, span, height table; JBU23's missing type is
  inferred as BCS3 from N3307J). The apparent width uses the heading against the line of sight.
  Heights: the build's `altSrc: geom` is the readsb `alt_geom` (index 10 of the raw trace, ft, WGS84 ellipsoid), so
  MSL = h + 28.6 m. The baro field reads "ground" on the ground, where the build writes 0 and the player uses 9 m MSL.
- **Chase view** (`js/chase.mjs`): a window of 3 airframe lengths at the object's range (wheel zooms, 0.6 to 40), at
  least 160 px of 8K. It is centred on pred + the smoothed (found - pred) offset, then Gaussian-smoothed over frames
  (σ 3 frames, centred: the whole span is known, so there is no lag). The white ring is the ADS-B prediction; the red box
  is the found object, with a dashed residual line between them; other aircraft predicted in the window are quiet rings.
  The inset at bottom right is the whole frame with the window drawn on it. The readout gives callsign, type, range,
  altitude, ground speed (the trace's curve and the ADS-B field), track, the source and its resolution, the magnification,
  pred, found, and the residual in px and degrees (right and down components).
- **Self-finding** (`js/find.mjs`): a size-matched contrast detector against the local background (colour distance from a
  box mean of about 1.5 object lengths). It scores the object box against a ring around it at 3 scales and turns the
  scores into robust z values. The centroid is re-centred 3 times. Then the candidates are filtered:
  - an object cut by the frame edge is dropped;
  - **blob height**: an aircraft stands up. Measured on this footage, the A321 reads 0.87-1.04 of its expected height and
    runway touchdown marks 0.55-0.63; kept: 0.72-1.7;
  - not where another object of this clip was already found at this frame.

  A **Viterbi** path over frames follows: smooth drift of the offset (σ 40 px/frame in the rough stretch, 8 elsewhere) and a
  "not found" state. Next, a **template** is built from the most confident picks (a 32x12 colour descriptor plus its
  high-pass half). There is a likeness floor, then a second Viterbi. Picks with no neighbours in time are dropped.
  The pipeline runs twice: a proxy scan of the whole span on a hidden second video element (about 3 s), then a refine on
  each exact 8K window as it lands. A frame looked at in 8K is decided there.
- **Cross-object prior (dual agency between objects)**: the confident residuals of an object tracked earlier in the
  session are the pose error at those frames. The next object is searched at pred + that residual, within 2.5° rather than
  12°, and the place the first object occupies is excluded.
- **Playback** (view-dependent rule): playing draws the proxy cropped to the window (soft, real time), with a live find
  where the scan did not sample. **Prefetch 8K** asks the frame service for each frame's window × 1.35 and nothing else,
  at the canvas resolution (never above native, and at least 14 px per object length). It runs 3 requests at a time and
  shows a progress bar. The JPEG blobs are cached and decoded 8 frames ahead. Paused frames fetch their own window on demand.
- **Export anchors**: downloads `object-anchors_<clip>_<icao>_<8 alnum>.json`, as below.
- **Shell state / 3D hook**: `S.track = { id: 'adsb:<icao>', kind, icao, callsign, type, clip }`, `?track=` in the URL,
  the window event `tp:track` (detail = S.track or null), and the 3D link carries `&track=<icao>`. takeoff-3d was not edited.

## Anchors written (`artifacts/calibration-8k/anchors/`)

Schema `bos-object-anchors/1`: `{ icao, callsign, clip, pose_file, hold_field, rows: [{ f, utc, pred:[u,v], found:[u,v]|null, conf, residual_px, d_px, residual_deg, d_deg, src, range_m, obj:{lat,lon,h_msl,interp,gap_s}, hfov_used, rough, consensus }], summary, review }`.
A row with `found` and `conf >= 0.3` is a candidate anchor. **Read `review` first**: I looked at the chase frames and
wrote a verdict into each file.

| file | object | verdict |
|---|---|---|
| `object-anchors_115459_a17c95_6ey9bv89.json` | AAL1205 A321, 0.45-0.48 km, taxiing | **accepted**: 67 found rows, f0-f66, every frame it is in; conf 0.93-0.97 |
| `object-anchors_115459_a39925_hss6h4rk.json` | JBU23 A220-300 (inferred), 0.74 km | no anchors: not in the picture (about 5-9° beyond the left edge once AAL1205's residual is applied) |
| `object-anchors_115459_a08f33_d7f078pe.json` | EJA135 GL5T parked, 1.6 km | **rejected**: f0-f66 not found (on AAL1205's line of sight); f67-f300 found rows are a hangar door |
| `object-anchors_115634_adc7aa_xis5kc3x.json` | N9871K P28A, 9.5-10.7 km | no anchors: 4-5 px long over haze; candidates are roofs (conf capped at 0.25) |
| `object-anchors_115531_a249d0_mixv11lh.json` | N2468Y T206, ~9 km | no anchors: about 6 px long against sky, nothing visible in the 8K windows |

JBU917 (BCS3, parked at the gate at 42.3679, -71.0156) is not predicted within 12° of any frame of 115459, so it is not offered.

## Result: predicted vs found, 115459 (rough stretch, hold field on)

AAL1205 (8K, every 6th frame; d = found - pred, + right / + down):

| f | UTC | pred | found | d px | d deg | total |
|---|---|---|---|---|---|---|
| 0 | 15:54:59.48 | 4047, 1892 | 2919, 1839 | -1128, -53 | -10.24, -0.49 | 10.24° |
| 6 | :59.82 | 3661, 1828 | 2724, 1855 | -937, +27 | -8.45, +0.25 | 8.44° |
| 18 | 55:00.22 | 3160, 1681 | 2223, 1841 | -937, +160 | -8.26, +1.46 | 8.38° |
| 30 | :00.62 | 2579, 1621 | 1696, 1910 | -883, +289 | -7.50, +2.63 | 7.94° |
| 42 | :01.02 | 1808, 1740 | 1180, 1993 | -628, +253 | -5.03, +2.30 | 5.50° |
| 54 | :01.42 | 741, 1837 | 690, 2115 | -52, +278 | -0.38, +2.53 | 2.30° |
| 60 | :01.62 | 71, 1799 | 455, 2191 | +384, +392 | +2.64, +3.57 | 4.05° |
| 66 | :01.82 | -686, 1678 | 289, 2308 | +975, +631 | +6.29, +5.75 | 7.88° |

Checks: at f60 the find is within 7 px of the v0.1.1 hand measurement (456, 2184). At the 8K still f_2 (t 1.5 s, f40-41) it is
within about 70 px of the hand measurement (1200, 1944). 1 s of ADS-B time error is about 1.2° along track here, so timing
cannot explain the residual.

**Is it a consistent offset?** No, not a constant one, but it is a clean one. The horizontal residual runs from -8.4°
(f6) to +6.3° (f66) while the pose's heading swings from 289.1° to 305.9°. Pose heading minus the horizontal residual gives
**297.5-300.2° over f0-f66**, nearly constant, which is what a camera on a straight takeoff roll should do. So most of the
rough rows' 17° heading swing is spurious, and the camera heading there is about 299 ± 1.3°. That is the calibration
correction for yaw.

The vertical residual (+0.2° to +5.7°) mixes pitch with the rows' roll swing (+1.3° to -10.7°). One object gives two
constraints per frame, so pitch and roll cannot be separated from AAL1205 alone. No second aircraft was found in those
frames: JBU23 is out of frame, and EJA135 is behind the A321 on nearly the same line of sight.

115634 / 115531 (solved poses): the GA aircraft were not found, as the table above says. Their candidates sit 0.1-1° from
the prediction, which is consistent with the held-out pose error of about 1°, but they are not measurements.

## Verified (headless Chrome via CDP, `verify/`)

- `verify/track-run.mjs` (scan, prefetch, step every frame, play, write anchors; `--first A,B` runs a session) and
  `verify/track-ui.mjs` (real mouse and key input), both checked:
  - Clicking AAL1205's label tracks it: S.track is set, the URL carries `track=AAL1205`, and `tp:track` fires.
  - Esc untracks, and the event fires with null.
  - The list offers AAL1205, JBU23, EJA135, N808FA and CGHLN for 115459.
  - The `?fix=` fixed view still opens, locks, and reads its lock residual 0.06 px.
  - The 390 px layout works.
  - No page errors.
- Prefetch, cold: AAL1205 103 windows in 71 s (15 MB, about 2300x1600 px of 8K each at about 1270 px out), EJA135 300 in
  268 s (49 MB), N9871K 326 in 385 s (1.6 MB: tiny windows at native). Warm (frame service cache): 1-2 s.
- Real-time play after prefetch, 4 s from f0: 114 distinct frames presented (30 fps). 76 of the 82 span frames were drawn
  from the cached 8K windows; the rest of the frames are outside the span (proxy, as intended).
- Media:
  - `verify/track_115459_AAL1205_chase_8k.mp4` (f0-f70, every frame, real time) and `..._third-speed.mp4`;
  - `verify/page_track_115459_AAL1205_f6.png`, `_f33.png`, `_f60.png`;
  - `verify/page_track_115459_EJA135_f180_hangar-door.png` (the failure), `_f30_after-AAL1205.png`;
  - `verify/page_track_115634_N9871K_f1914.png`, `verify/page_track_115531_N2468Y_f1824.png`, `verify/page_track_mobile_390.png`.

## Known limits

- **Identity is the weak point.** The finder is reliable when the object is the dominant compact, upright, aircraft-sized
  thing near where it should be. With an 8° pose error the 12° search disc around a parked jet next to hangars holds
  hangar doors and other aircraft, and it picks wrong (EJA135). The cross-object prior fixes this only where another object
  was found at the same frames. A moving-object test (the ground ring around a pick should slide against it by the ADS-B
  motion) was tried and dropped: background matching on this footage over 5-8 frames was too weak (ZNCC 0.2-0.6).
- Below about 8 px long (GA at 10 km) a find is a candidate, never an anchor.
- Parked aircraft with long trace gaps (EJA417 at 1019 s, GPD828 at 147 s) are not offered in the list (posAt drops gaps over 90 s).
- Window centring falls back to the prediction plus the last known offset where nothing is found (f67-f70 of AAL1205 as it leaves the frame).
- The anchors come from the browser (the export button). The files in `anchors/` were written by `verify/track-run.mjs`
  from the page's own `exportAnchors()`, with the review added.
- One object at a time; the 3D mode only gets the hook.
