tools: picture_metrics.py and the PICTURE block, numbers only from a frame on your disk (TOOLS-PICTURE-REPORT) #2455

Open
github-bot wants to merge 4 commits from github-bot/gh-2455 into main AGit
Owner

@⁠MoonEyes on GitHub · 2026-11-27 11:04 UTC · original
MoonEyes:feat/picture-metrics → main · +1027 −5 · 4 files · 4 commits · open

Adds tools/picture_metrics.py (standard library) and the PICTURE block in docs/agent_collaboration.md (TOOLS-PICTURE-REPORT).
From a PNG/PPM frame on your disk, numbers only: luma stats, 4x4 dark shares, lattice detector (tile, period, phase,
diagonal, corner), block-grid detector, per-8x8 diff against a reference, and a measured class (LATTICE, BLACK-NEAR,
BLOCKS, FLASH, OK). CHAR-BLACK, CHAR-MISSING, 2D-MISSING, STRAY-GEO and SMEAR are only given by a human (--class).
No pixels, paths or files in the output.
Test: python -I tests/test_picture_metrics.py draws synthetic PNGs and checks the drawn parameters come back; it fails
on main (no module). Not covered: real game frames; detectors are hints, several HUD rectangles can read as BLOCKS,
blocks off the grid read at a smaller size, and a lattice repeating fewer than 3 times is not reported. About 3 s per 720p frame. Claimed in #1608.
False positives measured on synthetic frames: LATTICE 3 of 1,009 sparse-dark-pixel frames (256x256 to 1280x720), 0 of 60 noise frames; BLOCKS 0 of 50 rectangle frames.
GPUs tested: none (no GPU needed)
AI-assisted (Claude Code, Claude Opus 5.5)
🤖 Generated with Claude Code

**@⁠MoonEyes** on GitHub · 2026-11-27 11:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2455) `MoonEyes:feat/picture-metrics` → `main` · +1027 −5 · 4 files · 4 commits · open Adds tools/picture_metrics.py (standard library) and the PICTURE block in docs/agent_collaboration.md (TOOLS-PICTURE-REPORT). From a PNG/PPM frame on your disk, numbers only: luma stats, 4x4 dark shares, lattice detector (tile, period, phase, diagonal, corner), block-grid detector, per-8x8 diff against a reference, and a measured class (LATTICE, BLACK-NEAR, BLOCKS, FLASH, OK). CHAR-BLACK, CHAR-MISSING, 2D-MISSING, STRAY-GEO and SMEAR are only given by a human (--class). No pixels, paths or files in the output. Test: python -I tests/test_picture_metrics.py draws synthetic PNGs and checks the drawn parameters come back; it fails on main (no module). Not covered: real game frames; detectors are hints, several HUD rectangles can read as BLOCKS, blocks off the grid read at a smaller size, and a lattice repeating fewer than 3 times is not reported. About 3 s per 720p frame. Claimed in #1608. False positives measured on synthetic frames: LATTICE 3 of 1,009 sparse-dark-pixel frames (256x256 to 1280x720), 0 of 60 noise frames; BLOCKS 0 of 50 rectangle frames. GPUs tested: none (no GPU needed) AI-assisted (Claude Code, Claude Opus 5.5) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
From a PNG or PPM frame on the user's disk, numbers only: luma statistics,
the dark share of a 4x4 grid of regions, a lattice detector (tile, period,
phase, diagonal, corner), a block-grid detector (block size and share of
blocks cut off), a per-8x8 diff against a second frame and a defect class.
LATTICE, BLACK-NEAR, BLOCKS, FLASH and OK are measured; CHAR-BLACK,
CHAR-MISSING, 2D-MISSING, STRAY-GEO and SMEAR need scene knowledge and are
only given by a human (--class, with --region for numbers). Standard
library: PNG read with zlib and struct (8-bit grey/RGB/RGBA, not
interlaced, five filters), binary PPM/PGM; the rest is refused. No pixels
or paths in the output; no file written.

docs/agent_collaboration.md gets the PICTURE block next to RUN, with an
example from a synthetic frame; the docs index line names it.

Tests: tests/test_picture_metrics.py draws synthetic frames and checks the
drawn parameters come back (20 tests).

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The lattice minimum counted marked tiles over the whole frame, so a corner
diagonal of one or two tiles covered fully at a large period and won: a
grey 256x256 frame with 15 random dark pixels read as LATTICE 20 times out
of 20. A class now counts only with 8 marked tiles on 3 diagonals that are
each half marked or more, and with marks off it under a quarter of its
cover. BLOCKS needs 3 edge lines on each axis (one sharp rectangle has two)
and a share of half or less (a checkerboard has no picture around it); the
docstring and docs/agent_collaboration.md say what it still misreads:
several sharp rectangles, and blocks off the frame's origin.

Tests: sparse random dark pixels at 256x256, 320x180, 640x360 and
1280x720, Gaussian noise, marks along rows, a lattice through noise, a
checkerboard and one rectangle (24 tests, 58 failures before the fix).

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A lattice that repeats fewer than three times is not reported, and a 1280x720 frame takes a few seconds; both
were in the tool's docstring only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 11:10:52 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2455/head:github-bot/gh-2455'
git switch 'github-bot/gh-2455'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2455'
git switch 'github-bot/gh-2455'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2455'
git switch 'github-bot/gh-2455'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2455'
git switch 'main'
git merge --squash 'github-bot/gh-2455'
git switch 'main'
git merge --ff-only 'github-bot/gh-2455'
git switch 'main'
git merge 'github-bot/gh-2455'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.