Ukrainian Pattern Archive

Embroidery-chart OCR to a deduplicated corpus: symmetry-invariant signatures (frieze groups) turn scanned vyshyvanka charts into editable parametric pattern formulas.

pythonocrcomputational-geometrycultural-heritageprivatein progress

Scanned cross-stitch embroidery charts (vyshyvanka) start out as a source PDF; the Ukrainian Pattern Archive turns that into a structured, deduplicated, re-editable pattern corpus for anyone documenting or working with Ukrainian folk-embroidery motifs. An OCR pipeline extracts each chart page, classifies every 5x5-pixel grid cell into a typed stitch (solid, hollow square, diagonal, bar, fragment) across six colors, splits pages into individual pattern rectangles, and infers each one’s basic repeat unit.

The interesting step is deduplication: two identity levels distinguish a genuinely new pattern from a recolored, shifted, or rotated copy of one already in the corpus. An exact unit_id hashes the literal cell data; a structural signature_id is computed to stay invariant under recoloring, any cyclic torus shift, and the eight symmetries of the dihedral group D4 — applied down to individual cell interiors, so diagonals flip and bars swap axis correctly under rotation. A separate fitting pass goes further, detecting each unit’s frieze symmetry group (one of seven: p1, p11g, p1m1, p11m, p2, p2mg, p2mm) and compressing it into an editable parametric formula — grid, element list, symmetry group — that round-trips cell-for-cell back to the original. The current OCR run produced 129 unique units from 171 candidate rectangles, 93 of them carrying non-trivial frieze symmetry.

A newer core library rebuilds this pipeline as a versioned Python package with multi-level content-hash fingerprints and a static-site viewer, deployed to Cloudflare Pages.

Status: in progress, source private. Active work continues on the newer core-library rewrite and its Cloudflare Pages viewer; the existing OCR pipeline and pattern DSL already run from the command line, with terminal, PNG, and browser-based review renderers for inspecting output.