# Consultant T-shirt logo re-bake (2026-10-03)

The consultant's chest logo is **painted into the film pixels**, not overlaid. The package's
`source/pipeline/logobake3.py` placed it one frame at a time with no tracking, so in
`beyond-a.mp4` and `connect-film.mp4` it jumped between the two sides of her chest, flickered off,
printed over her hair, and left the raw magenta chest marker showing (frames ~44–79 of beyond-a,
161–171 and 204 of connect-film). Owner report: *"the propertylab logo at the shirt got error"*.

These scripts redo that pass on the shipped films: track her upper body, erase every earlier print
and the marker, print one logo at one tracked spot, behind hair and hands. Output is live as
`beyond-a-v3.mp4` and `connect-film-v3.mp4` (new names: `/cinematic/assets/*` is cached immutable).

**v2 was wrong (same day, owner: *"the shirt surrounding like a lot blur square, the blur box square show at
the hair too"*).** Its erase step removed anything blue-ish, dark or pinkish in a wide box round the chest,
which caught hair edges, the skyline and the collar; each was refilled with a blurred patch. v3
(`rebake3.py`) erases ONLY: (1) old prints found by template match, (2) old prints the template misses —
a word-shaped cluster of print-coloured pixels ringed by white fabric (not inside a laptop frame, not on
blue sky), (3) the strictly-magenta marker and its fringe, (4) print-coloured pixels in a tight window
where the new print goes. Warm pixels (hair, skin) and long dark shapes (laptop bezels) are never erased.
Check a re-bake with a diff overlay of every changed pixel, not just crops of the logo.

Needs Python with `opencv-python-headless numpy`, ffmpeg, and the logo raster from the founder's
package (`source/brand/logo_tee.png`, passed as `LOGO=`). Work on extracted frames:
`ffmpeg -i film.mp4 -start_number 0 dir/f%03d.png`.

| Script | What it does |
|---|---|
| `track.py dir seed a0 a1 cx cy r out.json` | LK optical flow + RANSAC similarity, from a seed frame forwards and back, features inside a circle on her upper body |
| `traj.py track.json dir ax ay a0 a1 out.json` | anchor → per-frame x, y, scale, angle; where tracking is lost (blurred close-up) it anchors on the raw magenta marker; smooths |
| `plan.py '<json cfg>'` | connect-film: two tracked scenes cross-faded through the light-sweep morph (beyond-a's plan was built from `traj.py` output the same way) |
| `rebake3.py src dst plan.json` | the conservative erase above, refill from white fabric, print once behind hair/hands tinted by the light on the shirt |

What was run (frame indices are 0-based at 24 fps):

- **beyond-a**: `track.py ba 70 42 175 860 440 130`, `traj.py … 840 480 42 175`, logo width 80, rotation
  ×0.3 → `beyond-a.plan.json`; `LOGO=… rebake3.py ba out beyond-a.plan.json`.
- **connect-film**: seated scene tracked from frame 120 (anchor 480,560 — the left-chest spot clear of
  hair and laptop), standing scene from frame 230 (anchor 278,547, tighter radius 105 so the
  handshake does not drag it); the resulting plan is `connect-film.plan.json` (`marker_soft` on 160–172 for
  the washed-out marker under the light sweep; `extra`/`word` windows on 148–162 for an old print low left).
- Encode as the package does: `libx264 -preset slow -crf 20 -g 8 -keyint_min 8 -sc_threshold 0 -bf 0
  -pix_fmt yuv420p -movflags +faststart` (PSNR vs the original ≈ 40 dB outside the logo).

Known leftover: a small dark mark on the laptop bezel in connect-film 152–155, where an old print sat on
the bezel itself (bezels are never erased). The living-room shot (beyond-a 270+ / beyond-b 0–60) was already consistent and is
untouched.
