Add spritesheet reconstruction mode

This commit is contained in:
Meta Vens 2026-05-30 23:53:04 +01:00
commit 68a7e0ab0d
10 changed files with 587 additions and 4 deletions

View file

@ -80,6 +80,7 @@ What exists now:
- lattice inference with CUDA support
- the `phase-field` reconstruction engine in `src/repixelizer/phase_field.py`
- automatic diagnostics, comparisons, and benchmark runs
- spritesheet CLI mode that detects separated regions and repixelizes each region independently
- a tuning harness for offline parameter sweeps
- `source_fidelity` and `source_structure` metrics for lattice agreement and visible structure
- a shippable explicit local-search solver config, with tuning notes in `docs/solver-tuning-lessons-2026-04-29.md`
@ -116,6 +117,18 @@ Run the optimizer plus baselines:
repixelize compare input.png --out output.png --diagnostics-dir diagnostics
```
Run a spritesheet as separate sprite regions:
```powershell
repixelize spritesheet sheet.png --out output.png --sprite-count 6 --target-width 32 --target-height 32
repixelize spritesheet sheet.png --out output.png --diagnostics-dir diagnostics
```
When `--sprite-count` is omitted, Repixelizer detects large separated foreground
regions. Pinned target dimensions apply per sprite, not to the whole sheet. Add
`--strip-background` when the sheet has an opaque edge-connected backdrop that
should become transparent before cropping.
## Corpus And Benchmarks
Prepare a local Creative Commons corpus:
@ -173,6 +186,7 @@ That keeps benchmark assets, attribution exports, and tuning runs from polluting
Core modules:
- `inference.py`: target size inference
- `spritesheet.py`: spritesheet region detection and per-region pipeline orchestration
- `phase_field.py`: explicit local-search phase-field solver
- `metrics.py`: fidelity, adjacency, and motif metrics
- `benchmark.py`: corpus benchmark runner