Skip to content

stringart v1.0.0

Latest

Choose a tag to compare

@Prem-Dharshan Prem-Dharshan released this 03 Oct 09:16
· 6 commits to master since this release

First release of stringart, an OpenCV-based computational string-art pipeline (20XW97: Ajay H, Prem Dharshan D). It turns a photo into a pin sequence for one continuous thread (or one thread per colour), with a simulated render, a thread-by-thread animation and a build kit for a later physical piece.

What's in v1.0.0

  • Solver:
    • a physical thread model (opacity from thread width and frame size)
    • a self-stopping greedy that scores every candidate line in parallel (numba)
    • path refinement (delete, reroute, insert pins) that never increases the error
  • OpenCV preprocessing:
    • YuNet face-centred crop
    • automatic exposure correction (level stretch + gamma)
    • bilateral smoothing and CLAHE
  • Importance maps: LBF facial landmarks, Scharr edges and spectral-residual saliency (used automatically when a face is found).
  • Colour: a joint colour solver, a reachable-gamut thread palette, and a spool-switching limit.
  • Tools:
    • stringart run, viz (live player, mp4/GIF, snapshot grid), kit (1:1 pin template as A4 tiles + SVG, pin coordinates, shopping list), wind (winding assistant with saved progress), calibrate (thread calibration from a photo)
    • a local web demo (stringart demo)
    • 8 sample photos
  • Reproducibility: a Docker image with named volumes, scripts for every experiment, and 87 tests.

Results (simulated, 600 px, 256 pins)

result
Solver vs prior greedy (LessWrong/Vrellis), equal line count better SSIM σ2 on 29/30 images, about half the time
Full pipeline, face region face SSIM up on 22/22 face images (+0.060)
Refinement (2 sweeps) +0.011 SSIM σ2 (24/30), +0.015 face SSIM (21/22)
Exposure faults (held-out set) 0.591 → 0.650 SSIM vs 0.657 for the clean photo; 0/12 false alarms
Colour vs prior dither method CIEDE2000 −5.0, luminance SSIM +0.15, on 12/12 images

Details: docs/report/report.md and docs/milestones/.

Get started

uv sync --extra demo
uv run stringart fetch-models
uv run stringart run sample:woman_smiling
uv run --extra demo stringart demo      # http://127.0.0.1:7860

The full setup and argument reference is in the README; a physical build later is covered by docs/BUILD_GUIDE.md.

Known limitations

  • Simulation only so far: no physical piece has been built, and calibration is validated on synthetic photos.
  • The automatic stop and refinement minimize weighted squared error, not SSIM.
  • The gamut palette trades a little light/dark structure for colour accuracy.
  • Washed-out photos recover only partly on held-out images.